mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-17 01:49:57 -05:00
Merge pull request #38481 from a-tarasyuk/bug/38463
fix(38463): No indexed access completions after Record<...>
This commit is contained in:
@@ -223,9 +223,7 @@ namespace ts.Completions.StringCompletions {
|
||||
function stringLiteralCompletionsFromProperties(type: Type | undefined): StringLiteralCompletionsFromProperties | undefined {
|
||||
return type && {
|
||||
kind: StringLiteralCompletionKind.Properties,
|
||||
symbols: type.getApparentProperties().filter(prop =>
|
||||
!isPrivateIdentifierPropertyDeclaration(
|
||||
isTransientSymbol(prop) && prop.syntheticOrigin ? prop.syntheticOrigin.valueDeclaration : prop.valueDeclaration)),
|
||||
symbols: filter(type.getApparentProperties(), prop => !(prop.valueDeclaration && isPrivateIdentifierPropertyDeclaration(prop.valueDeclaration))),
|
||||
hasIndexSignature: hasIndexSignature(type)
|
||||
};
|
||||
}
|
||||
|
||||
18
tests/cases/fourslash/completionForStringLiteral14.ts
Normal file
18
tests/cases/fourslash/completionForStringLiteral14.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////interface Foo {
|
||||
//// a: string;
|
||||
//// b: boolean;
|
||||
//// c: number;
|
||||
////}
|
||||
////type Bar = Record<keyof Foo, any>["[|/**/|]"];
|
||||
|
||||
const replacementSpan = test.ranges()[0]
|
||||
verify.completions({
|
||||
marker: "",
|
||||
exact: [
|
||||
{ name: "a", replacementSpan },
|
||||
{ name: "b", replacementSpan },
|
||||
{ name: "c", replacementSpan }
|
||||
]
|
||||
});
|
||||
12
tests/cases/fourslash/completionForStringLiteral15.ts
Normal file
12
tests/cases/fourslash/completionForStringLiteral15.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////let x: { [_ in "foo"]: string } = {
|
||||
//// "[|/**/|]"
|
||||
////}
|
||||
|
||||
verify.completions({
|
||||
marker: "",
|
||||
exact: [
|
||||
{ name: "foo", replacementSpan: test.ranges()[0] }
|
||||
]
|
||||
});
|
||||
Reference in New Issue
Block a user