Fix globalThis completions (#30441)

* Fix, but with test not quite right

* Add missing completions to test

* Remove out-of-date comment
This commit is contained in:
Nathan Shively-Sanders 2019-03-15 19:10:39 -07:00 committed by GitHub
parent cabf72b514
commit 658798032b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 1 deletions

View file

@ -890,7 +890,9 @@ namespace ts.Completions {
}
// If the module is merged with a value, we must get the type of the class and add its propertes (for inherited static methods).
if (!isTypeLocation && symbol.declarations.some(d => d.kind !== SyntaxKind.SourceFile && d.kind !== SyntaxKind.ModuleDeclaration && d.kind !== SyntaxKind.EnumDeclaration)) {
if (!isTypeLocation &&
symbol.declarations &&
symbol.declarations.some(d => d.kind !== SyntaxKind.SourceFile && d.kind !== SyntaxKind.ModuleDeclaration && d.kind !== SyntaxKind.EnumDeclaration)) {
addTypeProperties(typeChecker.getTypeOfSymbolAtLocation(symbol, node));
}

View file

@ -0,0 +1,12 @@
/// <reference path='fourslash.ts'/>
////globalThis./**/
verify.completions({
marker: "",
exact: [
{ name: "globalThis", kind: "module" },
...completion.globalsVars,
{ name: "undefined", kind: "var" }
]
});