refactor(compiler-cli): return TS nodes from TypeTranslatorVisitor (#28342)

The TypeTranslatorVisitor visitor returned strings because before it wasn't possible to transform declaration files directly through the TypeScript custom transformer API.

Now that's possible though, so it should return nodes instead.

PR Close #28342
This commit is contained in:
Filipe Silva
2019-01-25 12:12:57 +00:00
committed by Jason Aden
parent d45d3a3ef9
commit bcf17bc91c
4 changed files with 63 additions and 60 deletions

View File

@ -57,8 +57,7 @@ export class DtsFileTransformer {
const decls = this.ivyFields.get(node.name.text) !;
const newMembers = decls.map(decl => {
const modifiers = [ts.createModifier(ts.SyntaxKind.StaticKeyword)];
const type = translateType(decl.type, this.imports);
const typeRef = ts.createTypeReferenceNode(ts.createIdentifier(type), undefined);
const typeRef = translateType(decl.type, this.imports);
return ts.createProperty(undefined, modifiers, decl.name, undefined, typeRef, undefined);
});