Skip to content

Commit 62675a5

Browse files
Merge pull request microsoft#38481 from a-tarasyuk/bug/38463
fix(38463): No indexed access completions after Record<...>
2 parents 59d0cee + e40a2bc commit 62675a5

File tree

3 files changed

+31
-3
lines changed

3 files changed

+31
-3
lines changed

src/services/stringCompletions.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,7 @@ namespace ts.Completions.StringCompletions {
223223
function stringLiteralCompletionsFromProperties(type: Type | undefined): StringLiteralCompletionsFromProperties | undefined {
224224
return type && {
225225
kind: StringLiteralCompletionKind.Properties,
226-
symbols: type.getApparentProperties().filter(prop =>
227-
!isPrivateIdentifierPropertyDeclaration(
228-
isTransientSymbol(prop) && prop.syntheticOrigin ? prop.syntheticOrigin.valueDeclaration : prop.valueDeclaration)),
226+
symbols: filter(type.getApparentProperties(), prop => !(prop.valueDeclaration && isPrivateIdentifierPropertyDeclaration(prop.valueDeclaration))),
229227
hasIndexSignature: hasIndexSignature(type)
230228
};
231229
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/// <reference path='fourslash.ts'/>
2+
3+
////interface Foo {
4+
//// a: string;
5+
//// b: boolean;
6+
//// c: number;
7+
////}
8+
////type Bar = Record<keyof Foo, any>["[|/**/|]"];
9+
10+
const replacementSpan = test.ranges()[0]
11+
verify.completions({
12+
marker: "",
13+
exact: [
14+
{ name: "a", replacementSpan },
15+
{ name: "b", replacementSpan },
16+
{ name: "c", replacementSpan }
17+
]
18+
});
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/// <reference path='fourslash.ts'/>
2+
3+
////let x: { [_ in "foo"]: string } = {
4+
//// "[|/**/|]"
5+
////}
6+
7+
verify.completions({
8+
marker: "",
9+
exact: [
10+
{ name: "foo", replacementSpan: test.ranges()[0] }
11+
]
12+
});

0 commit comments

Comments
 (0)