Skip to content

Commit 7c93aff

Browse files
committed
fix typeof completions broken
1 parent b8def16 commit 7c93aff

File tree

4 files changed

+19
-4
lines changed

4 files changed

+19
-4
lines changed

src/compiler/checker.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19263,8 +19263,8 @@ namespace ts {
1926319263
}
1926419264
}
1926519265

19266-
function isValidPropertyAccessForCompletions(node: PropertyAccessExpression | ImportTypeNode, type: Type, property: Symbol): boolean {
19267-
return isValidPropertyAccessWithType(node, node.kind !== SyntaxKind.ImportType && node.expression.kind === SyntaxKind.SuperKeyword, property.escapedName, type)
19266+
function isValidPropertyAccessForCompletions(node: PropertyAccessExpression | ImportTypeNode | QualifiedName, type: Type, property: Symbol): boolean {
19267+
return isValidPropertyAccessWithType(node, node.kind === SyntaxKind.PropertyAccessExpression && node.expression.kind === SyntaxKind.SuperKeyword, property.escapedName, type)
1926819268
&& (!(property.flags & SymbolFlags.Method) || isValidMethodAccess(property, type));
1926919269
}
1927019270
function isValidMethodAccess(method: Symbol, actualThisType: Type): boolean {

src/compiler/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3108,7 +3108,7 @@ namespace ts {
31083108
getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): string | number | undefined;
31093109
isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName | ImportTypeNode, propertyName: string): boolean;
31103110
/** Exclude accesses to private properties or methods with a `this` parameter that `type` doesn't satisfy. */
3111-
/* @internal */ isValidPropertyAccessForCompletions(node: PropertyAccessExpression | ImportTypeNode, type: Type, property: Symbol): boolean;
3111+
/* @internal */ isValidPropertyAccessForCompletions(node: PropertyAccessExpression | ImportTypeNode | QualifiedName, type: Type, property: Symbol): boolean;
31123112
/** Follow all aliases to get the original symbol. */
31133113
getAliasedSymbol(symbol: Symbol): Symbol;
31143114
/** Follow a *single* alias to get the immediately aliased symbol. */

src/services/completions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -913,7 +913,7 @@ namespace ts.Completions {
913913
}
914914
else {
915915
for (const symbol of type.getApparentProperties()) {
916-
if (typeChecker.isValidPropertyAccessForCompletions(node.kind === SyntaxKind.ImportType ? <ImportTypeNode>node : <PropertyAccessExpression>node.parent, type, symbol)) {
916+
if (typeChecker.isValidPropertyAccessForCompletions(node.kind === SyntaxKind.ImportType ? <ImportTypeNode>node : <PropertyAccessExpression | QualifiedName>node.parent, type, symbol)) {
917917
addPropertySymbol(symbol);
918918
}
919919
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/// <reference path="fourslash.ts" />
2+
3+
//// const x = "str";
4+
//// function test(arg: typeof x./*1*/) {}
5+
//// function test1(arg: typeof (x./*2*/)) {}
6+
7+
verify.completions({
8+
marker: "1",
9+
includes: ['length']
10+
});
11+
12+
verify.completions({
13+
marker: "2",
14+
includes: ['length']
15+
});

0 commit comments

Comments
 (0)