Skip to content

Commit aa6be6e

Browse files
authored
fix(37364): show completions for string literal index on mapped type (#37367)
1 parent 52dc9f2 commit aa6be6e

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

src/services/stringCompletions.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,9 @@ 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 => !isPrivateIdentifierPropertyDeclaration(prop.valueDeclaration)),
226+
symbols: type.getApparentProperties().filter(prop =>
227+
!isPrivateIdentifierPropertyDeclaration(
228+
isTransientSymbol(prop) && prop.syntheticOrigin ? prop.syntheticOrigin.valueDeclaration : prop.valueDeclaration)),
227229
hasIndexSignature: hasIndexSignature(type)
228230
};
229231
}
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+
////type Foo = {
4+
//// a: string;
5+
//// b: string;
6+
////};
7+
////
8+
////type A = Readonly<Foo>;
9+
////type B = A["[|/**/|]"]
10+
11+
const replacementSpan = test.ranges()[0];
12+
verify.completions({
13+
marker: "",
14+
exact: [
15+
{ name: "a", replacementSpan },
16+
{ name: "b", replacementSpan }
17+
]
18+
});

0 commit comments

Comments
 (0)