Skip to content

Commit

Permalink
fix: IndexSignatureDeclaration.getStructure() should use the node tex…
Browse files Browse the repository at this point in the history
…t and not the type text.
  • Loading branch information
dsherret committed Sep 22, 2018
1 parent aea96a3 commit 61f1345
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/compiler/interface/IndexSignatureDeclaration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ export class IndexSignatureDeclaration extends IndexSignatureDeclarationBase<ts.
getStructure(): IndexSignatureDeclarationStructure {
return callBaseGetStructure<IndexSignatureDeclarationSpecificStructure>(IndexSignatureDeclarationBase.prototype, this, {
keyName: this.getKeyName(),
keyType: this.getKeyType().getText(),
returnType: this.getReturnType().getText()
keyType: this.getKeyTypeNode().getText(),
returnType: this.getReturnTypeNode().getText()
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -229,12 +229,13 @@ describe(nameof(IndexSignatureDeclaration), () => {
}

it("should get when not has anything", () => {
doTest("interface Identifier { [key: string]: number; }", {
// use type aliases to make sure the node text and not the type text is returned
doTest("interface Identifier { [key: OtherType]: MyType; } type OtherType = number; type MyType = string;", {
isReadonly: false,
keyName: "key",
keyType: "string",
keyType: "OtherType",
docs: [],
returnType: "number"
returnType: "MyType"
});
});

Expand Down

0 comments on commit 61f1345

Please sign in to comment.