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:
parent
c42f35eb2f
commit
a32cbed89c
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue