-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Release 3.1.1; Fix accessor comment (#19)
- Loading branch information
1 parent
16d2615
commit 27504ca
Showing
6 changed files
with
122 additions
and
6 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
|
||
import ps from 'path'; | ||
import fs from 'fs-extra'; | ||
import { bundle } from '../../source/gift'; | ||
|
||
test('Type alias', async () => { | ||
const inputPath = ps.join(__dirname, 'input.d.ts'); | ||
const outputPath = ps.join(__dirname, 'output.d.ts'); | ||
const { groups } = bundle({ | ||
input: inputPath, | ||
rootModule: 'foo', | ||
name: 'out/index', | ||
output: outputPath, | ||
}); | ||
expect(groups.length).toBe(1); | ||
const group0 = groups[0]; | ||
|
||
if (!await fs.pathExists(outputPath)) { | ||
await fs.outputFile(outputPath, group0.code, { encoding: 'utf8' }); | ||
} else { | ||
const expected = await fs.readFile(outputPath, 'utf8'); | ||
expect(group0.code).toBe(expected); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
|
||
|
||
declare module "foo" { | ||
/** | ||
* Variable. | ||
*/ | ||
export const v: number; | ||
|
||
/** | ||
* Function. | ||
*/ | ||
export function f(p1: number, p2: string): void; | ||
|
||
/** | ||
* Class. | ||
*/ | ||
export class C { | ||
/** | ||
* Constructor. | ||
*/ | ||
constructor(); | ||
|
||
/** | ||
* Property | ||
*/ | ||
p: number; | ||
|
||
/** | ||
* Get accessor. | ||
*/ | ||
get a(): number; | ||
|
||
/** | ||
* Set accessor. | ||
*/ | ||
set a(value: number); | ||
|
||
/** | ||
* Method. | ||
*/ | ||
m(p1: number, p2: number): void; | ||
} | ||
|
||
/** | ||
* Namespace. | ||
*/ | ||
export * as bar from 'bar'; | ||
} | ||
|
||
declare module "bar" { | ||
export class Bar {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
declare module "out/index" { | ||
/** | ||
* Function. | ||
*/ | ||
export function f(p1: number, p2: string): void; | ||
/** | ||
* Variable. | ||
*/ | ||
export const v: number; | ||
/** | ||
* Class. | ||
*/ | ||
export class C { | ||
/** | ||
* Constructor. | ||
*/ | ||
constructor(); | ||
/** | ||
* Property | ||
*/ | ||
p: number; | ||
/** | ||
* Get accessor. | ||
*/ | ||
get a(): number; | ||
/** | ||
* Set accessor. | ||
*/ | ||
set a(value: number); | ||
/** | ||
* Method. | ||
*/ | ||
m(p1: number, p2: number): void; | ||
} | ||
export namespace bar { | ||
export class Bar { | ||
} | ||
} | ||
export {}; | ||
} |