fix(language-service): use empty statement as parent of type node (#36989)

In TypeScript 3.9, type nodes need to exist in the context of a statement.
This commit ensures that the synthetic type node has such a parent.

PR Close #36989
This commit is contained in:
Keen Yee Liau 2020-05-12 08:19:58 +01:00 committed by Kara Erickson
parent c42f35eb2f
commit a32cbed89c
1 changed files with 1 additions and 1 deletions

View File

@ -827,7 +827,7 @@ function getTsTypeFromBuiltinType(builtinType: BuiltinType, ctx: TypeContext): t
`Internal error, unhandled literal kind ${builtinType}:${BuiltinType[builtinType]}`); `Internal error, unhandled literal kind ${builtinType}:${BuiltinType[builtinType]}`);
} }
const node = ts.createNode(syntaxKind); const node = ts.createNode(syntaxKind);
node.parent = ctx.node; node.parent = ts.createEmptyStatement();
return ctx.checker.getTypeAtLocation(node); return ctx.checker.getTypeAtLocation(node);
} }