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:
parent
cabf72b514
commit
658798032b
2 changed files with 15 additions and 1 deletions
|
@ -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));
|
||||
}
|
||||
|
||||
|
|
12
tests/cases/fourslash/completionAfterGlobalThis.ts
Normal file
12
tests/cases/fourslash/completionAfterGlobalThis.ts
Normal file
|
@ -0,0 +1,12 @@
|
|||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////globalThis./**/
|
||||
|
||||
verify.completions({
|
||||
marker: "",
|
||||
exact: [
|
||||
{ name: "globalThis", kind: "module" },
|
||||
...completion.globalsVars,
|
||||
{ name: "undefined", kind: "var" }
|
||||
]
|
||||
});
|
Loading…
Reference in a new issue