Skip to content

Commit ec54f69

Browse files
authored
Merge pull request #5 from TypeScript-Heroes/develop
Release 2017-07-11
2 parents 8c3751b + 360503e commit ec54f69

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

package.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,11 @@
3030
"url": "https://github.com/TypeScript-Heroes/node-typescript-parser/issues"
3131
},
3232
"homepage": "https://github.com/TypeScript-Heroes/node-typescript-parser#readme",
33-
"release": {
34-
"generateNotes": "github-post-release"
35-
},
3633
"devDependencies": {
3734
"@types/jest": "^20.0.1",
3835
"@types/mock-fs": "^3.6.30",
3936
"@types/node": "^8.0.1",
4037
"del-cli": "^1.0.0",
41-
"github-post-release": "^1.7.1",
4238
"jest": "^20.0.4",
4339
"mock-fs": "^4.4.1",
4440
"semantic-release": "^6.3.6",

src/code-generators/TypescriptCodeGenerator.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,15 @@ import { TypescriptGenerationOptions } from './TypescriptGenerationOptions';
3030
*/
3131
export type Generatable = Declaration | Import | Export | SymbolSpecifier;
3232

33-
type Generators = { [name: string]: (generatable: Generatable, options: TypescriptGenerationOptions) => string };
33+
/**
34+
* Type for generators.
35+
*/
36+
export type Generators = { [name: string]: (generatable: Generatable, options: TypescriptGenerationOptions) => string };
3437

35-
const generators: Generators = {
38+
/**
39+
* Hash with all possible (yet implemented) generators.
40+
*/
41+
export const GENERATORS: Generators = {
3642
[SymbolSpecifier.name]: generateSymbolSpecifier,
3743
[MethodDeclaration.name]: generateMethodDeclaration,
3844
[ParameterDeclaration.name]: generateParameterDeclaration,
@@ -63,8 +69,8 @@ export class TypescriptCodeGenerator {
6369
* @memberof TypescriptCodeGenerator
6470
*/
6571
public generate(declaration: Generatable): string {
66-
if (generators[declaration.constructor.name]) {
67-
return generators[declaration.constructor.name](declaration, this.options);
72+
if (GENERATORS[declaration.constructor.name]) {
73+
return GENERATORS[declaration.constructor.name](declaration, this.options);
6874
}
6975
throw new NotGeneratableYetError(declaration);
7076
}

0 commit comments

Comments
 (0)