diff --git a/tools/dtsgen/declarator.ts b/tools/dtsgen/declarator.ts index eb96f2a4..f29e7f53 100644 --- a/tools/dtsgen/declarator.ts +++ b/tools/dtsgen/declarator.ts @@ -1,8 +1,6 @@ import * as ts from "typescript"; import {SyntaxKind} from "typescript"; -type TSExpression = ts.Type | ts.Node; - interface Array { last?(): T; } @@ -102,9 +100,9 @@ class StackParameters implements StackParameter { } -const generators: {[key: number]:((settings: _Settings, stack: StackParameters, node: ts.Node | ts.Type) => ts.Node | ts.Type | undefined) | undefined} = {}; +const generators: {[key: number]:((settings: _Settings, stack: StackParameters, node: ts.Node) => ts.Node | undefined) | undefined} = {}; -function _generate(settings: _Settings, stack: StackParameters, layer: TSExpression[], node: ts.Node) { +function _generate(settings: _Settings, stack: StackParameters, layer: ts.Node[], node: ts.Node) { //console.log(SyntaxKind[node.kind]); if(generators[node.kind]) { const result = generators[node.kind](settings, stack, node); @@ -324,6 +322,7 @@ generators[SyntaxKind.ClassDeclaration] = (settings, stack, node: ts.ClassDeclar }; generators[SyntaxKind.PropertySignature] = (settings, stack, node: ts.PropertySignature) => { + console.log(SyntaxKind[node.type.kind]); let type: ts.TypeNode = node.type; switch (node.type.kind) { case SyntaxKind.LiteralType: @@ -384,11 +383,4 @@ generators[SyntaxKind.EnumDeclaration] = (settings, stack, node: ts.EnumDeclarat for(const member of node.members) members.push(generators[SyntaxKind.EnumMember](settings, stack, member)); return ts.createEnumDeclaration(undefined, append_export(append_declare(node.modifiers, !stack.flag_declare), stack.flag_namespace), node.name, members); -}; - - -generators[SyntaxKind.TypeParameter] = (settings, stack, node: ts.TypeParameter) => undefined; -generators[SyntaxKind.HeritageClause] = (settings, stack, node: ts.HeritageClause) => undefined; -generators[SyntaxKind.IfStatement] = (settings, stack, node: ts.IfStatement) => undefined; -generators[SyntaxKind.ExpressionStatement] = (settings, stack, node: ts.ExpressionStatement) => undefined; -generators[SyntaxKind.SemicolonClassElement] = (settings, stack, node: ts.ExpressionStatement) => undefined; \ No newline at end of file +}; \ No newline at end of file diff --git a/tools/dtsgen/out.d.ts b/tools/dtsgen/out.d.ts index d2410873..152bd336 100644 --- a/tools/dtsgen/out.d.ts +++ b/tools/dtsgen/out.d.ts @@ -1,6 +1,13 @@ -/* File: /home/wolverindev/TeaSpeak/TeaSpeak/Web-Client/tools/dtsgen/test/test_04.ts */ -declare class TestClass extends Promise { +/* File: /home/wolverindev/TeaSpeak/TeaSpeak/Web-Client/tools/dtsgen/test/test_03.ts */ +declare enum YY { + H, + B +} +declare interface X { + type: any; + c: YY.B; +} +declare class X { + static x(); } -declare const lambda_function; -declare const lambda_function2; diff --git a/tools/dtsgen/test/test_04.ts b/tools/dtsgen/test/test_04.ts deleted file mode 100644 index 1263a5e6..00000000 --- a/tools/dtsgen/test/test_04.ts +++ /dev/null @@ -1,4 +0,0 @@ -class TestClass extends Promise { } - -const lambda_function = (str) => {}; -const lambda_function2 = (str: string) => {}; \ No newline at end of file