Skip to content

Commit a08b045

Browse files
danay1999Danay Fernandez Alfonsoandrewbranch
authoredAug 25, 2022
Jsdoc property description (#50269)
* jsdocPropertyDescription * jsdocPropertyDescription * jsdocPropertyDescription * Fixes #47933 * added additional test * added additional example * fixed bug * changed function to only grab the literal type * added additional condition for literals and symbols * added additional test cases * Update src/services/symbolDisplay.ts Co-authored-by: Andrew Branch <andrewbranch@users.noreply.github.com> * addressed PR review * addressed new PR review Co-authored-by: Danay Fernandez Alfonso <t-danayf@microsoft.com> Co-authored-by: Andrew Branch <andrewbranch@users.noreply.github.com>
1 parent 5ba22e0 commit a08b045

38 files changed

+322
-5
lines changed
 

‎src/compiler/checker.ts

+30
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,7 @@ namespace ts {
439439
getTypeOfPropertyOfType: (type, name) => getTypeOfPropertyOfType(type, escapeLeadingUnderscores(name)),
440440
getIndexInfoOfType: (type, kind) => getIndexInfoOfType(type, kind === IndexKind.String ? stringType : numberType),
441441
getIndexInfosOfType,
442+
getIndexInfosOfIndexSymbol,
442443
getSignaturesOfType,
443444
getIndexTypeOfType: (type, kind) => getIndexTypeOfType(type, kind === IndexKind.String ? stringType : numberType),
444445
getIndexType: type => getIndexType(type),
@@ -42615,6 +42616,35 @@ namespace ts {
4261542616

4261642617
if (name.kind === SyntaxKind.PropertyAccessExpression) {
4261742618
checkPropertyAccessExpression(name, CheckMode.Normal);
42619+
if (!links.resolvedSymbol) {
42620+
const expressionType = checkExpressionCached(name.expression);
42621+
const infos = getApplicableIndexInfos(expressionType, getLiteralTypeFromPropertyName(name.name));
42622+
if (infos.length && (expressionType as ObjectType).members) {
42623+
const resolved = resolveStructuredTypeMembers(expressionType as ObjectType);
42624+
const symbol = resolved.members.get(InternalSymbolName.Index);
42625+
if (infos === getIndexInfosOfType(expressionType)) {
42626+
links.resolvedSymbol = symbol;
42627+
}
42628+
else if (symbol) {
42629+
const symbolLinks = getSymbolLinks(symbol);
42630+
const declarationList = mapDefined(infos, i => i.declaration);
42631+
const nodeListId = map(declarationList, getNodeId).join(",");
42632+
if (!symbolLinks.filteredIndexSymbolCache) {
42633+
symbolLinks.filteredIndexSymbolCache = new Map();
42634+
}
42635+
if (symbolLinks.filteredIndexSymbolCache.has(nodeListId)) {
42636+
links.resolvedSymbol = symbolLinks.filteredIndexSymbolCache.get(nodeListId)!;
42637+
}
42638+
else {
42639+
const copy = createSymbol(SymbolFlags.Signature, InternalSymbolName.Index);
42640+
copy.declarations = mapDefined(infos, i => i.declaration);
42641+
copy.parent = expressionType.aliasSymbol ? expressionType.aliasSymbol : expressionType.symbol ? expressionType.symbol : getSymbolAtLocation(copy.declarations[0].parent);
42642+
symbolLinks.filteredIndexSymbolCache.set(nodeListId, copy);
42643+
links.resolvedSymbol = symbolLinks.filteredIndexSymbolCache.get(nodeListId)!;
42644+
}
42645+
}
42646+
}
42647+
}
4261842648
}
4261942649
else {
4262042650
checkQualifiedName(name, CheckMode.Normal);

‎src/compiler/types.ts

+2
Original file line numberDiff line numberDiff line change
@@ -4557,6 +4557,7 @@ namespace ts {
45574557
/* @internal */ getTypeOfPropertyOfType(type: Type, propertyName: string): Type | undefined;
45584558
getIndexInfoOfType(type: Type, kind: IndexKind): IndexInfo | undefined;
45594559
getIndexInfosOfType(type: Type): readonly IndexInfo[];
4560+
getIndexInfosOfIndexSymbol: (indexSymbol: Symbol) => IndexInfo[];
45604561
getSignaturesOfType(type: Type, kind: SignatureKind): readonly Signature[];
45614562
getIndexTypeOfType(type: Type, kind: IndexKind): Type | undefined;
45624563
/* @internal */ getIndexType(type: Type): Type;
@@ -5373,6 +5374,7 @@ namespace ts {
53735374
isConstructorDeclaredProperty?: boolean; // Property declared through 'this.x = ...' assignment in constructor
53745375
tupleLabelDeclaration?: NamedTupleMember | ParameterDeclaration; // Declaration associated with the tuple's label
53755376
accessibleChainCache?: ESMap<string, Symbol[] | undefined>;
5377+
filteredIndexSymbolCache?: ESMap<string, Symbol> //Symbol with applicable declarations
53765378
}
53775379

53785380
/* @internal */

‎src/services/symbolDisplay.ts

+31-5
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ namespace ts.SymbolDisplay {
6464
if (flags & SymbolFlags.SetAccessor) return ScriptElementKind.memberSetAccessorElement;
6565
if (flags & SymbolFlags.Method) return ScriptElementKind.memberFunctionElement;
6666
if (flags & SymbolFlags.Constructor) return ScriptElementKind.constructorImplementationElement;
67+
if (flags & SymbolFlags.Signature) return ScriptElementKind.indexSignatureElement;
6768

6869
if (flags & SymbolFlags.Property) {
6970
if (flags & SymbolFlags.Transient && (symbol as TransientSymbol).checkFlags & CheckFlags.Synthetic) {
@@ -506,19 +507,19 @@ namespace ts.SymbolDisplay {
506507
else {
507508
addPrefixForAnyFunctionOrVar(symbol, symbolKind);
508509
}
509-
510510
// For properties, variables and local vars: show the type
511511
if (symbolKind === ScriptElementKind.memberVariableElement ||
512512
symbolKind === ScriptElementKind.memberGetAccessorElement ||
513513
symbolKind === ScriptElementKind.memberSetAccessorElement ||
514514
symbolKind === ScriptElementKind.jsxAttribute ||
515515
symbolFlags & SymbolFlags.Variable ||
516516
symbolKind === ScriptElementKind.localVariableElement ||
517+
symbolKind === ScriptElementKind.indexSignatureElement ||
517518
isThisExpression) {
518519
displayParts.push(punctuationPart(SyntaxKind.ColonToken));
519520
displayParts.push(spacePart());
520521
// If the type is type parameter, format it specially
521-
if (type.symbol && type.symbol.flags & SymbolFlags.TypeParameter) {
522+
if (type.symbol && type.symbol.flags & SymbolFlags.TypeParameter && symbolKind !== ScriptElementKind.indexSignatureElement) {
522523
const typeParameterParts = mapToDisplayParts(writer => {
523524
const param = typeChecker.typeParameterToDeclaration(type as TypeParameter, enclosingDeclaration, symbolDisplayNodeBuilderFlags)!;
524525
getPrinter().writeNode(EmitHint.Unspecified, param, getSourceFileOfNode(getParseTreeNode(enclosingDeclaration)), writer);
@@ -639,13 +640,38 @@ namespace ts.SymbolDisplay {
639640
}
640641

641642
function addFullSymbolName(symbolToDisplay: Symbol, enclosingDeclaration?: Node) {
643+
let indexInfos;
644+
642645
if (alias && symbolToDisplay === symbol) {
643646
symbolToDisplay = alias;
644647
}
645-
const fullSymbolDisplayParts = symbolToDisplayParts(typeChecker, symbolToDisplay, enclosingDeclaration || sourceFile, /*meaning*/ undefined,
646-
SymbolFormatFlags.WriteTypeParametersOrArguments | SymbolFormatFlags.UseOnlyExternalAliasing | SymbolFormatFlags.AllowAnyNodeKind);
647-
addRange(displayParts, fullSymbolDisplayParts);
648+
if (symbolKind === ScriptElementKind.indexSignatureElement) {
649+
indexInfos = typeChecker.getIndexInfosOfIndexSymbol(symbolToDisplay);
650+
}
648651

652+
let fullSymbolDisplayParts: SymbolDisplayPart[] = [];
653+
if (symbolToDisplay.flags & SymbolFlags.Signature && indexInfos) {
654+
if (symbolToDisplay.parent) {
655+
fullSymbolDisplayParts = symbolToDisplayParts(typeChecker, symbolToDisplay.parent);
656+
}
657+
fullSymbolDisplayParts.push(punctuationPart(SyntaxKind.OpenBracketToken));
658+
//Needed to handle more than one type of index
659+
indexInfos.forEach((info, i) => {
660+
//Needed to handle template literals
661+
fullSymbolDisplayParts.push(...typeToDisplayParts(typeChecker, info.keyType));
662+
if (i !== indexInfos.length - 1) {
663+
fullSymbolDisplayParts.push(spacePart());
664+
fullSymbolDisplayParts.push(punctuationPart(SyntaxKind.BarToken));
665+
fullSymbolDisplayParts.push(spacePart());
666+
}
667+
});
668+
fullSymbolDisplayParts.push(punctuationPart(SyntaxKind.CloseBracketToken));
669+
}
670+
else {
671+
fullSymbolDisplayParts = symbolToDisplayParts(typeChecker, symbolToDisplay, enclosingDeclaration || sourceFile, /*meaning*/ undefined,
672+
SymbolFormatFlags.WriteTypeParametersOrArguments | SymbolFormatFlags.UseOnlyExternalAliasing | SymbolFormatFlags.AllowAnyNodeKind);
673+
}
674+
addRange(displayParts, fullSymbolDisplayParts);
649675
if (symbol.flags & SymbolFlags.Optional) {
650676
displayParts.push(punctuationPart(SyntaxKind.QuestionToken));
651677
}

‎tests/baselines/reference/api/tsserverlibrary.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -2316,6 +2316,7 @@ declare namespace ts {
23162316
getPrivateIdentifierPropertyOfType(leftType: Type, name: string, location: Node): Symbol | undefined;
23172317
getIndexInfoOfType(type: Type, kind: IndexKind): IndexInfo | undefined;
23182318
getIndexInfosOfType(type: Type): readonly IndexInfo[];
2319+
getIndexInfosOfIndexSymbol: (indexSymbol: Symbol) => IndexInfo[];
23192320
getSignaturesOfType(type: Type, kind: SignatureKind): readonly Signature[];
23202321
getIndexTypeOfType(type: Type, kind: IndexKind): Type | undefined;
23212322
getBaseTypes(type: InterfaceType): BaseType[];

‎tests/baselines/reference/api/typescript.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -2316,6 +2316,7 @@ declare namespace ts {
23162316
getPrivateIdentifierPropertyOfType(leftType: Type, name: string, location: Node): Symbol | undefined;
23172317
getIndexInfoOfType(type: Type, kind: IndexKind): IndexInfo | undefined;
23182318
getIndexInfosOfType(type: Type): readonly IndexInfo[];
2319+
getIndexInfosOfIndexSymbol: (indexSymbol: Symbol) => IndexInfo[];
23192320
getSignaturesOfType(type: Type, kind: SignatureKind): readonly Signature[];
23202321
getIndexTypeOfType(type: Type, kind: IndexKind): Type | undefined;
23212322
getBaseTypes(type: InterfaceType): BaseType[];

‎tests/baselines/reference/controlFlowElementAccess2.symbols

+6
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ if (typeof config['works'] !== 'boolean') {
1313

1414
config.works.prop = 'test'; // ok
1515
>config.works.prop : Symbol(prop, Decl(controlFlowElementAccess2.ts, 1, 30))
16+
>config.works : Symbol(__index, Decl(controlFlowElementAccess2.ts, 0, 23))
1617
>config : Symbol(config, Decl(controlFlowElementAccess2.ts, 0, 13))
18+
>works : Symbol(__index, Decl(controlFlowElementAccess2.ts, 0, 23))
1719
>prop : Symbol(prop, Decl(controlFlowElementAccess2.ts, 1, 30))
1820

1921
config['works'].prop = 'test'; // error, config['works']: boolean | { 'prop': string }
@@ -22,7 +24,9 @@ if (typeof config['works'] !== 'boolean') {
2224
>prop : Symbol(prop, Decl(controlFlowElementAccess2.ts, 1, 30))
2325
}
2426
if (typeof config.works !== 'boolean') {
27+
>config.works : Symbol(__index, Decl(controlFlowElementAccess2.ts, 0, 23))
2528
>config : Symbol(config, Decl(controlFlowElementAccess2.ts, 0, 13))
29+
>works : Symbol(__index, Decl(controlFlowElementAccess2.ts, 0, 23))
2630

2731
config['works'].prop = 'test'; // error, config['works']: boolean | { 'prop': string }
2832
>config['works'].prop : Symbol(prop, Decl(controlFlowElementAccess2.ts, 1, 30))
@@ -31,7 +35,9 @@ if (typeof config.works !== 'boolean') {
3135

3236
config.works.prop = 'test'; // ok
3337
>config.works.prop : Symbol(prop, Decl(controlFlowElementAccess2.ts, 1, 30))
38+
>config.works : Symbol(__index, Decl(controlFlowElementAccess2.ts, 0, 23))
3439
>config : Symbol(config, Decl(controlFlowElementAccess2.ts, 0, 13))
40+
>works : Symbol(__index, Decl(controlFlowElementAccess2.ts, 0, 23))
3541
>prop : Symbol(prop, Decl(controlFlowElementAccess2.ts, 1, 30))
3642
}
3743

‎tests/baselines/reference/controlFlowStringIndex.symbols

+6
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,15 @@ declare const value: A;
1414
>A : Symbol(A, Decl(controlFlowStringIndex.ts, 0, 0))
1515

1616
if (value.foo !== null) {
17+
>value.foo : Symbol(A.__index, Decl(controlFlowStringIndex.ts, 1, 25))
1718
>value : Symbol(value, Decl(controlFlowStringIndex.ts, 4, 13))
19+
>foo : Symbol(A.__index, Decl(controlFlowStringIndex.ts, 1, 25))
1820

1921
value.foo.toExponential()
2022
>value.foo.toExponential : Symbol(Number.toExponential, Decl(lib.es5.d.ts, --, --))
23+
>value.foo : Symbol(A.__index, Decl(controlFlowStringIndex.ts, 1, 25))
2124
>value : Symbol(value, Decl(controlFlowStringIndex.ts, 4, 13))
25+
>foo : Symbol(A.__index, Decl(controlFlowStringIndex.ts, 1, 25))
2226
>toExponential : Symbol(Number.toExponential, Decl(lib.es5.d.ts, --, --))
2327

2428
value.other // should still be number | null
@@ -27,6 +31,8 @@ if (value.foo !== null) {
2731
>other : Symbol(other, Decl(controlFlowStringIndex.ts, 0, 10))
2832

2933
value.bar // should still be number | null
34+
>value.bar : Symbol(A.__index, Decl(controlFlowStringIndex.ts, 1, 25))
3035
>value : Symbol(value, Decl(controlFlowStringIndex.ts, 4, 13))
36+
>bar : Symbol(A.__index, Decl(controlFlowStringIndex.ts, 1, 25))
3137
}
3238

‎tests/baselines/reference/deleteExpressionMustBeOptional(strict=false).symbols

+4
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,14 @@ delete f.j
105105
>f : Symbol(f, Decl(deleteExpressionMustBeOptional.ts, 20, 13))
106106

107107
delete a.a
108+
>a.a : Symbol(AA.__index, Decl(deleteExpressionMustBeOptional.ts, 12, 14))
108109
>a : Symbol(a, Decl(deleteExpressionMustBeOptional.ts, 21, 13))
110+
>a : Symbol(AA.__index, Decl(deleteExpressionMustBeOptional.ts, 12, 14))
109111

110112
delete a.b
113+
>a.b : Symbol(AA.__index, Decl(deleteExpressionMustBeOptional.ts, 12, 14))
111114
>a : Symbol(a, Decl(deleteExpressionMustBeOptional.ts, 21, 13))
115+
>b : Symbol(AA.__index, Decl(deleteExpressionMustBeOptional.ts, 12, 14))
112116

113117
delete b.a
114118
>b : Symbol(b, Decl(deleteExpressionMustBeOptional.ts, 22, 13))

‎tests/baselines/reference/deleteExpressionMustBeOptional(strict=true).symbols

+4
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,14 @@ delete f.j
105105
>f : Symbol(f, Decl(deleteExpressionMustBeOptional.ts, 20, 13))
106106

107107
delete a.a
108+
>a.a : Symbol(AA.__index, Decl(deleteExpressionMustBeOptional.ts, 12, 14))
108109
>a : Symbol(a, Decl(deleteExpressionMustBeOptional.ts, 21, 13))
110+
>a : Symbol(AA.__index, Decl(deleteExpressionMustBeOptional.ts, 12, 14))
109111

110112
delete a.b
113+
>a.b : Symbol(AA.__index, Decl(deleteExpressionMustBeOptional.ts, 12, 14))
111114
>a : Symbol(a, Decl(deleteExpressionMustBeOptional.ts, 21, 13))
115+
>b : Symbol(AA.__index, Decl(deleteExpressionMustBeOptional.ts, 12, 14))
112116

113117
delete b.a
114118
>b : Symbol(b, Decl(deleteExpressionMustBeOptional.ts, 22, 13))

‎tests/baselines/reference/deleteExpressionMustBeOptional_exactOptionalPropertyTypes(exactoptionalpropertytypes=false).symbols

+4
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,14 @@ delete g.j
158158
>g : Symbol(g, Decl(deleteExpressionMustBeOptional_exactOptionalPropertyTypes.ts, 21, 13))
159159

160160
delete a.a
161+
>a.a : Symbol(AA.__index, Decl(deleteExpressionMustBeOptional_exactOptionalPropertyTypes.ts, 12, 14))
161162
>a : Symbol(a, Decl(deleteExpressionMustBeOptional_exactOptionalPropertyTypes.ts, 22, 13))
163+
>a : Symbol(AA.__index, Decl(deleteExpressionMustBeOptional_exactOptionalPropertyTypes.ts, 12, 14))
162164

163165
delete a.b
166+
>a.b : Symbol(AA.__index, Decl(deleteExpressionMustBeOptional_exactOptionalPropertyTypes.ts, 12, 14))
164167
>a : Symbol(a, Decl(deleteExpressionMustBeOptional_exactOptionalPropertyTypes.ts, 22, 13))
168+
>b : Symbol(AA.__index, Decl(deleteExpressionMustBeOptional_exactOptionalPropertyTypes.ts, 12, 14))
165169

166170
delete b.a
167171
>b : Symbol(b, Decl(deleteExpressionMustBeOptional_exactOptionalPropertyTypes.ts, 23, 13))

‎tests/baselines/reference/deleteExpressionMustBeOptional_exactOptionalPropertyTypes(exactoptionalpropertytypes=true).symbols

+4
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,14 @@ delete g.j
158158
>g : Symbol(g, Decl(deleteExpressionMustBeOptional_exactOptionalPropertyTypes.ts, 21, 13))
159159

160160
delete a.a
161+
>a.a : Symbol(AA.__index, Decl(deleteExpressionMustBeOptional_exactOptionalPropertyTypes.ts, 12, 14))
161162
>a : Symbol(a, Decl(deleteExpressionMustBeOptional_exactOptionalPropertyTypes.ts, 22, 13))
163+
>a : Symbol(AA.__index, Decl(deleteExpressionMustBeOptional_exactOptionalPropertyTypes.ts, 12, 14))
162164

163165
delete a.b
166+
>a.b : Symbol(AA.__index, Decl(deleteExpressionMustBeOptional_exactOptionalPropertyTypes.ts, 12, 14))
164167
>a : Symbol(a, Decl(deleteExpressionMustBeOptional_exactOptionalPropertyTypes.ts, 22, 13))
168+
>b : Symbol(AA.__index, Decl(deleteExpressionMustBeOptional_exactOptionalPropertyTypes.ts, 12, 14))
165169

166170
delete b.a
167171
>b : Symbol(b, Decl(deleteExpressionMustBeOptional_exactOptionalPropertyTypes.ts, 23, 13))

‎tests/baselines/reference/emitAccessExpressionOfCastedObjectLiteralExpressionInArrowFunctionES5.symbols

+2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88

99
(x) => ({ "1": "one", "2": "two" } as { [key: string]: string }).x;
1010
>x : Symbol(x, Decl(emitAccessExpressionOfCastedObjectLiteralExpressionInArrowFunctionES5.ts, 1, 1))
11+
>({ "1": "one", "2": "two" } as { [key: string]: string }).x : Symbol(__index, Decl(emitAccessExpressionOfCastedObjectLiteralExpressionInArrowFunctionES5.ts, 1, 39))
1112
>"1" : Symbol("1", Decl(emitAccessExpressionOfCastedObjectLiteralExpressionInArrowFunctionES5.ts, 1, 9))
1213
>"2" : Symbol("2", Decl(emitAccessExpressionOfCastedObjectLiteralExpressionInArrowFunctionES5.ts, 1, 21))
1314
>key : Symbol(key, Decl(emitAccessExpressionOfCastedObjectLiteralExpressionInArrowFunctionES5.ts, 1, 41))
15+
>x : Symbol(__index, Decl(emitAccessExpressionOfCastedObjectLiteralExpressionInArrowFunctionES5.ts, 1, 39))
1416

‎tests/baselines/reference/emitAccessExpressionOfCastedObjectLiteralExpressionInArrowFunctionES6.symbols

+2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88

99
(x) => ({ "1": "one", "2": "two" } as { [key: string]: string }).x;
1010
>x : Symbol(x, Decl(emitAccessExpressionOfCastedObjectLiteralExpressionInArrowFunctionES6.ts, 1, 1))
11+
>({ "1": "one", "2": "two" } as { [key: string]: string }).x : Symbol(__index, Decl(emitAccessExpressionOfCastedObjectLiteralExpressionInArrowFunctionES6.ts, 1, 39))
1112
>"1" : Symbol("1", Decl(emitAccessExpressionOfCastedObjectLiteralExpressionInArrowFunctionES6.ts, 1, 9))
1213
>"2" : Symbol("2", Decl(emitAccessExpressionOfCastedObjectLiteralExpressionInArrowFunctionES6.ts, 1, 21))
1314
>key : Symbol(key, Decl(emitAccessExpressionOfCastedObjectLiteralExpressionInArrowFunctionES6.ts, 1, 41))
15+
>x : Symbol(__index, Decl(emitAccessExpressionOfCastedObjectLiteralExpressionInArrowFunctionES6.ts, 1, 39))
1416

‎tests/baselines/reference/indexSignatures1.symbols

+2
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,9 @@ const y1 = dom['data123'];
133133

134134
const y2 = dom.data123;
135135
>y2 : Symbol(y2, Decl(indexSignatures1.ts, 47, 5))
136+
>dom.data123 : Symbol(__index, Decl(indexSignatures1.ts, 45, 18))
136137
>dom : Symbol(dom, Decl(indexSignatures1.ts, 45, 11))
138+
>data123 : Symbol(__index, Decl(indexSignatures1.ts, 45, 18))
137139

138140
// Excess property checking for template pattern index signature
139141

‎tests/baselines/reference/keyofAndIndexedAccess2.symbols

+4
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,9 @@ function f2<T extends { [key: string]: number }>(a: { x: number, y: number }, b:
9090
>x : Symbol(x, Decl(keyofAndIndexedAccess2.ts, 12, 53))
9191

9292
b.x;
93+
>b.x : Symbol(__index, Decl(keyofAndIndexedAccess2.ts, 12, 82))
9394
>b : Symbol(b, Decl(keyofAndIndexedAccess2.ts, 12, 77))
95+
>x : Symbol(__index, Decl(keyofAndIndexedAccess2.ts, 12, 82))
9496

9597
c.x;
9698
>c : Symbol(c, Decl(keyofAndIndexedAccess2.ts, 12, 107))
@@ -105,7 +107,9 @@ function f2<T extends { [key: string]: number }>(a: { x: number, y: number }, b:
105107
>x : Symbol(x, Decl(keyofAndIndexedAccess2.ts, 12, 53))
106108

107109
b.x = 1;
110+
>b.x : Symbol(__index, Decl(keyofAndIndexedAccess2.ts, 12, 82))
108111
>b : Symbol(b, Decl(keyofAndIndexedAccess2.ts, 12, 77))
112+
>x : Symbol(__index, Decl(keyofAndIndexedAccess2.ts, 12, 82))
109113

110114
c.x = 1; // Error, cannot write to index signature through constraint
111115
>c : Symbol(c, Decl(keyofAndIndexedAccess2.ts, 12, 107))

‎tests/baselines/reference/noPropertyAccessFromIndexSignature1.symbols

+6
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ a["foo"]
5151

5252
// access index signature
5353
b.foo;
54+
>b.foo : Symbol(B.__index, Decl(noPropertyAccessFromIndexSignature1.ts, 4, 13))
5455
>b : Symbol(b, Decl(noPropertyAccessFromIndexSignature1.ts, 14, 13))
56+
>foo : Symbol(B.__index, Decl(noPropertyAccessFromIndexSignature1.ts, 4, 13))
5557

5658
b["foo"];
5759
>b : Symbol(b, Decl(noPropertyAccessFromIndexSignature1.ts, 14, 13))
@@ -68,7 +70,9 @@ c["foo"]
6870

6971
// access index signature
7072
c.bar;
73+
>c.bar : Symbol(C.__index, Decl(noPropertyAccessFromIndexSignature1.ts, 9, 15))
7174
>c : Symbol(c, Decl(noPropertyAccessFromIndexSignature1.ts, 15, 13))
75+
>bar : Symbol(C.__index, Decl(noPropertyAccessFromIndexSignature1.ts, 9, 15))
7276

7377
c["bar"];
7478
>c : Symbol(c, Decl(noPropertyAccessFromIndexSignature1.ts, 15, 13))
@@ -85,7 +89,9 @@ d?.["foo"]
8589

8690
// optional access index signature
8791
d?.bar;
92+
>d?.bar : Symbol(C.__index, Decl(noPropertyAccessFromIndexSignature1.ts, 9, 15))
8893
>d : Symbol(d, Decl(noPropertyAccessFromIndexSignature1.ts, 16, 13))
94+
>bar : Symbol(C.__index, Decl(noPropertyAccessFromIndexSignature1.ts, 9, 15))
8995

9096
d?.["bar"];
9197
>d : Symbol(d, Decl(noPropertyAccessFromIndexSignature1.ts, 16, 13))

‎tests/baselines/reference/noUncheckedIndexedAccess.symbols

+6
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ const e1: boolean = strMap["foo"];
3636

3737
const e2: boolean = strMap.bar;
3838
>e2 : Symbol(e2, Decl(noUncheckedIndexedAccess.ts, 12, 5))
39+
>strMap.bar : Symbol(__index, Decl(noUncheckedIndexedAccess.ts, 8, 23))
3940
>strMap : Symbol(strMap, Decl(noUncheckedIndexedAccess.ts, 8, 13))
41+
>bar : Symbol(__index, Decl(noUncheckedIndexedAccess.ts, 8, 23))
4042

4143
const e3: boolean = strMap[0];
4244
>e3 : Symbol(e3, Decl(noUncheckedIndexedAccess.ts, 13, 5))
@@ -114,7 +116,9 @@ const ok1: boolean | undefined = strMap["foo"];
114116

115117
const ok2: boolean | undefined = strMap.bar;
116118
>ok2 : Symbol(ok2, Decl(noUncheckedIndexedAccess.ts, 28, 5))
119+
>strMap.bar : Symbol(__index, Decl(noUncheckedIndexedAccess.ts, 8, 23))
117120
>strMap : Symbol(strMap, Decl(noUncheckedIndexedAccess.ts, 8, 13))
121+
>bar : Symbol(__index, Decl(noUncheckedIndexedAccess.ts, 8, 23))
118122

119123
type T_OK1 = CheckBooleanOnly<(typeof strMap)[string]>;
120124
>T_OK1 : Symbol(T_OK1, Decl(noUncheckedIndexedAccess.ts, 28, 44))
@@ -147,7 +151,9 @@ strMap["baz"] = undefined;
147151
>undefined : Symbol(undefined)
148152

149153
strMap.qua = undefined;
154+
>strMap.qua : Symbol(__index, Decl(noUncheckedIndexedAccess.ts, 8, 23))
150155
>strMap : Symbol(strMap, Decl(noUncheckedIndexedAccess.ts, 8, 13))
156+
>qua : Symbol(__index, Decl(noUncheckedIndexedAccess.ts, 8, 23))
151157
>undefined : Symbol(undefined)
152158

153159
strMap[0] = undefined;

‎tests/baselines/reference/propertyAccessOfReadonlyIndexSignature.symbols

+2
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,7 @@ declare var a: Test;
1111
>Test : Symbol(Test, Decl(propertyAccessOfReadonlyIndexSignature.ts, 0, 0))
1212

1313
a.foo = 'baz';
14+
>a.foo : Symbol(Test.__index, Decl(propertyAccessOfReadonlyIndexSignature.ts, 0, 16))
1415
>a : Symbol(a, Decl(propertyAccessOfReadonlyIndexSignature.ts, 4, 11))
16+
>foo : Symbol(Test.__index, Decl(propertyAccessOfReadonlyIndexSignature.ts, 0, 16))
1517

‎tests/baselines/reference/propertyAccessStringIndexSignature.symbols

+6
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,19 @@ let flags: Flags;
88
>Flags : Symbol(Flags, Decl(propertyAccessStringIndexSignature.ts, 0, 0))
99

1010
flags.b;
11+
>flags.b : Symbol(Flags.__index, Decl(propertyAccessStringIndexSignature.ts, 0, 17))
1112
>flags : Symbol(flags, Decl(propertyAccessStringIndexSignature.ts, 1, 3))
13+
>b : Symbol(Flags.__index, Decl(propertyAccessStringIndexSignature.ts, 0, 17))
1214

1315
flags.f;
16+
>flags.f : Symbol(Flags.__index, Decl(propertyAccessStringIndexSignature.ts, 0, 17))
1417
>flags : Symbol(flags, Decl(propertyAccessStringIndexSignature.ts, 1, 3))
18+
>f : Symbol(Flags.__index, Decl(propertyAccessStringIndexSignature.ts, 0, 17))
1519

1620
flags.isNotNecessarilyNeverFalse;
21+
>flags.isNotNecessarilyNeverFalse : Symbol(Flags.__index, Decl(propertyAccessStringIndexSignature.ts, 0, 17))
1722
>flags : Symbol(flags, Decl(propertyAccessStringIndexSignature.ts, 1, 3))
23+
>isNotNecessarilyNeverFalse : Symbol(Flags.__index, Decl(propertyAccessStringIndexSignature.ts, 0, 17))
1824

1925
flags['this is fine'];
2026
>flags : Symbol(flags, Decl(propertyAccessStringIndexSignature.ts, 1, 3))

‎tests/baselines/reference/propertyAccessStringIndexSignatureNoImplicitAny.symbols

+6
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,19 @@ let flags: Flags;
88
>Flags : Symbol(Flags, Decl(propertyAccessStringIndexSignatureNoImplicitAny.ts, 0, 0))
99

1010
flags.b;
11+
>flags.b : Symbol(Flags.__index, Decl(propertyAccessStringIndexSignatureNoImplicitAny.ts, 0, 17))
1112
>flags : Symbol(flags, Decl(propertyAccessStringIndexSignatureNoImplicitAny.ts, 1, 3))
13+
>b : Symbol(Flags.__index, Decl(propertyAccessStringIndexSignatureNoImplicitAny.ts, 0, 17))
1214

1315
flags.f;
16+
>flags.f : Symbol(Flags.__index, Decl(propertyAccessStringIndexSignatureNoImplicitAny.ts, 0, 17))
1417
>flags : Symbol(flags, Decl(propertyAccessStringIndexSignatureNoImplicitAny.ts, 1, 3))
18+
>f : Symbol(Flags.__index, Decl(propertyAccessStringIndexSignatureNoImplicitAny.ts, 0, 17))
1519

1620
flags.isNotNecessarilyNeverFalse;
21+
>flags.isNotNecessarilyNeverFalse : Symbol(Flags.__index, Decl(propertyAccessStringIndexSignatureNoImplicitAny.ts, 0, 17))
1722
>flags : Symbol(flags, Decl(propertyAccessStringIndexSignatureNoImplicitAny.ts, 1, 3))
23+
>isNotNecessarilyNeverFalse : Symbol(Flags.__index, Decl(propertyAccessStringIndexSignatureNoImplicitAny.ts, 0, 17))
1824

1925
flags['this is fine'];
2026
>flags : Symbol(flags, Decl(propertyAccessStringIndexSignatureNoImplicitAny.ts, 1, 3))

‎tests/baselines/reference/staticIndexSignature1.symbols

+2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ C["foo"] = 1
1313
>C : Symbol(C, Decl(staticIndexSignature1.ts, 0, 0))
1414

1515
C.bar = 2;
16+
>C.bar : Symbol(C.__index, Decl(staticIndexSignature1.ts, 0, 9))
1617
>C : Symbol(C, Decl(staticIndexSignature1.ts, 0, 0))
18+
>bar : Symbol(C.__index, Decl(staticIndexSignature1.ts, 0, 9))
1719

1820
const foo = C["foo"]
1921
>foo : Symbol(foo, Decl(staticIndexSignature1.ts, 7, 5))

‎tests/baselines/reference/staticIndexSignature2.symbols

+2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ C["foo"] = 1
1313
>C : Symbol(C, Decl(staticIndexSignature2.ts, 0, 0))
1414

1515
C.bar = 2;
16+
>C.bar : Symbol(C.__index, Decl(staticIndexSignature2.ts, 0, 9))
1617
>C : Symbol(C, Decl(staticIndexSignature2.ts, 0, 0))
18+
>bar : Symbol(C.__index, Decl(staticIndexSignature2.ts, 0, 9))
1719

1820
const foo = C["foo"]
1921
>foo : Symbol(foo, Decl(staticIndexSignature2.ts, 7, 5))

‎tests/baselines/reference/staticIndexSignature4.symbols

+24
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,12 @@ if (v === 0) {
4040
>v : Symbol(v, Decl(staticIndexSignature4.ts, 15, 13))
4141

4242
B.a = D.a
43+
>B.a : Symbol(B.__index, Decl(staticIndexSignature4.ts, 0, 9))
4344
>B : Symbol(B, Decl(staticIndexSignature4.ts, 0, 0))
45+
>a : Symbol(B.__index, Decl(staticIndexSignature4.ts, 0, 9))
46+
>D.a : Symbol(D.__index, Decl(staticIndexSignature4.ts, 5, 9))
4447
>D : Symbol(D, Decl(staticIndexSignature4.ts, 3, 1))
48+
>a : Symbol(D.__index, Decl(staticIndexSignature4.ts, 5, 9))
4549

4650
B[2] = D[2]
4751
>B : Symbol(B, Decl(staticIndexSignature4.ts, 0, 0))
@@ -51,8 +55,12 @@ if (v === 0) {
5155
>v : Symbol(v, Decl(staticIndexSignature4.ts, 15, 13))
5256

5357
D.a = B.a
58+
>D.a : Symbol(D.__index, Decl(staticIndexSignature4.ts, 5, 9))
5459
>D : Symbol(D, Decl(staticIndexSignature4.ts, 3, 1))
60+
>a : Symbol(D.__index, Decl(staticIndexSignature4.ts, 5, 9))
61+
>B.a : Symbol(B.__index, Decl(staticIndexSignature4.ts, 0, 9))
5562
>B : Symbol(B, Decl(staticIndexSignature4.ts, 0, 0))
63+
>a : Symbol(B.__index, Decl(staticIndexSignature4.ts, 0, 9))
5664

5765
D[2] = B[2]
5866
>D : Symbol(D, Decl(staticIndexSignature4.ts, 3, 1))
@@ -62,16 +70,24 @@ if (v === 0) {
6270
>v : Symbol(v, Decl(staticIndexSignature4.ts, 15, 13))
6371

6472
B.a = i.a
73+
>B.a : Symbol(B.__index, Decl(staticIndexSignature4.ts, 0, 9))
6574
>B : Symbol(B, Decl(staticIndexSignature4.ts, 0, 0))
75+
>a : Symbol(B.__index, Decl(staticIndexSignature4.ts, 0, 9))
76+
>i.a : Symbol(IB.__index, Decl(staticIndexSignature4.ts, 10, 14))
6677
>i : Symbol(i, Decl(staticIndexSignature4.ts, 16, 13))
78+
>a : Symbol(IB.__index, Decl(staticIndexSignature4.ts, 10, 14))
6779

6880
B[2] = i[2]
6981
>B : Symbol(B, Decl(staticIndexSignature4.ts, 0, 0))
7082
>i : Symbol(i, Decl(staticIndexSignature4.ts, 16, 13))
7183

7284
D.a = i.a
85+
>D.a : Symbol(D.__index, Decl(staticIndexSignature4.ts, 5, 9))
7386
>D : Symbol(D, Decl(staticIndexSignature4.ts, 3, 1))
87+
>a : Symbol(D.__index, Decl(staticIndexSignature4.ts, 5, 9))
88+
>i.a : Symbol(IB.__index, Decl(staticIndexSignature4.ts, 10, 14))
7489
>i : Symbol(i, Decl(staticIndexSignature4.ts, 16, 13))
90+
>a : Symbol(IB.__index, Decl(staticIndexSignature4.ts, 10, 14))
7591

7692
D[2] = i [2]
7793
>D : Symbol(D, Decl(staticIndexSignature4.ts, 3, 1))
@@ -81,8 +97,12 @@ if (v === 0) {
8197
>v : Symbol(v, Decl(staticIndexSignature4.ts, 15, 13))
8298

8399
i.a = B.a
100+
>i.a : Symbol(IB.__index, Decl(staticIndexSignature4.ts, 10, 14))
84101
>i : Symbol(i, Decl(staticIndexSignature4.ts, 16, 13))
102+
>a : Symbol(IB.__index, Decl(staticIndexSignature4.ts, 10, 14))
103+
>B.a : Symbol(B.__index, Decl(staticIndexSignature4.ts, 0, 9))
85104
>B : Symbol(B, Decl(staticIndexSignature4.ts, 0, 0))
105+
>a : Symbol(B.__index, Decl(staticIndexSignature4.ts, 0, 9))
86106

87107
i[2] = B[2]
88108
>i : Symbol(i, Decl(staticIndexSignature4.ts, 16, 13))
@@ -92,8 +112,12 @@ if (v === 0) {
92112
>v : Symbol(v, Decl(staticIndexSignature4.ts, 15, 13))
93113

94114
i.a = D.a
115+
>i.a : Symbol(IB.__index, Decl(staticIndexSignature4.ts, 10, 14))
95116
>i : Symbol(i, Decl(staticIndexSignature4.ts, 16, 13))
117+
>a : Symbol(IB.__index, Decl(staticIndexSignature4.ts, 10, 14))
118+
>D.a : Symbol(D.__index, Decl(staticIndexSignature4.ts, 5, 9))
96119
>D : Symbol(D, Decl(staticIndexSignature4.ts, 3, 1))
120+
>a : Symbol(D.__index, Decl(staticIndexSignature4.ts, 5, 9))
97121

98122
i[2] = B[2]
99123
>i : Symbol(i, Decl(staticIndexSignature4.ts, 16, 13))

‎tests/baselines/reference/staticIndexSignature6.symbols

+4
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,14 @@ const C = foo()
2424
>foo : Symbol(foo, Decl(staticIndexSignature6.ts, 0, 0))
2525

2626
C.a;
27+
>C.a : Symbol((Anonymous class).__index, Decl(staticIndexSignature6.ts, 1, 21))
2728
>C : Symbol(C, Decl(staticIndexSignature6.ts, 9, 5))
29+
>a : Symbol((Anonymous class).__index, Decl(staticIndexSignature6.ts, 1, 21))
2830

2931
C.a = 1;
32+
>C.a : Symbol((Anonymous class).__index, Decl(staticIndexSignature6.ts, 1, 21))
3033
>C : Symbol(C, Decl(staticIndexSignature6.ts, 9, 5))
34+
>a : Symbol((Anonymous class).__index, Decl(staticIndexSignature6.ts, 1, 21))
3135

3236
C[2];
3337
>C : Symbol(C, Decl(staticIndexSignature6.ts, 9, 5))

‎tests/baselines/reference/thisTypeInFunctions2.symbols

+4
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,9 @@ extend2({
9393
>this : Symbol(IndexedWithoutThis, Decl(thisTypeInFunctions2.ts, 5, 1))
9494

9595
this.mine
96+
>this.mine : Symbol(IndexedWithoutThis.__index, Decl(thisTypeInFunctions2.ts, 9, 29))
9697
>this : Symbol(IndexedWithoutThis, Decl(thisTypeInFunctions2.ts, 5, 1))
98+
>mine : Symbol(IndexedWithoutThis.__index, Decl(thisTypeInFunctions2.ts, 9, 29))
9799

98100
},
99101
mine: 13,
@@ -106,7 +108,9 @@ extend2({
106108
>this : Symbol(IndexedWithoutThis, Decl(thisTypeInFunctions2.ts, 5, 1))
107109

108110
this.mine
111+
>this.mine : Symbol(IndexedWithoutThis.__index, Decl(thisTypeInFunctions2.ts, 9, 29))
109112
>this : Symbol(IndexedWithoutThis, Decl(thisTypeInFunctions2.ts, 5, 1))
113+
>mine : Symbol(IndexedWithoutThis.__index, Decl(thisTypeInFunctions2.ts, 9, 29))
110114
}
111115
});
112116

‎tests/baselines/reference/typeGuardOfFromPropNameInUnionType.symbols

+6
Original file line numberDiff line numberDiff line change
@@ -306,16 +306,22 @@ function f(i: Indexed) {
306306
>i : Symbol(i, Decl(typeGuardOfFromPropNameInUnionType.ts, 96, 11))
307307

308308
return i.a;
309+
>i.a : Symbol(Indexed.__index, Decl(typeGuardOfFromPropNameInUnionType.ts, 92, 19))
309310
>i : Symbol(i, Decl(typeGuardOfFromPropNameInUnionType.ts, 96, 11))
311+
>a : Symbol(Indexed.__index, Decl(typeGuardOfFromPropNameInUnionType.ts, 92, 19))
310312
}
311313
else if ("b" in i) {
312314
>i : Symbol(i, Decl(typeGuardOfFromPropNameInUnionType.ts, 96, 11))
313315

314316
return i.b;
317+
>i.b : Symbol(Indexed.__index, Decl(typeGuardOfFromPropNameInUnionType.ts, 92, 19))
315318
>i : Symbol(i, Decl(typeGuardOfFromPropNameInUnionType.ts, 96, 11))
319+
>b : Symbol(Indexed.__index, Decl(typeGuardOfFromPropNameInUnionType.ts, 92, 19))
316320
}
317321
return "c" in i && i.c;
318322
>i : Symbol(i, Decl(typeGuardOfFromPropNameInUnionType.ts, 96, 11))
323+
>i.c : Symbol(Indexed.__index, Decl(typeGuardOfFromPropNameInUnionType.ts, 92, 19))
319324
>i : Symbol(i, Decl(typeGuardOfFromPropNameInUnionType.ts, 96, 11))
325+
>c : Symbol(Indexed.__index, Decl(typeGuardOfFromPropNameInUnionType.ts, 92, 19))
320326
}
321327

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
///<reference path="fourslash.ts" />
2+
3+
//// interface StringExample {
4+
//// /** Something generic */
5+
//// [p: string]: any;
6+
//// /** Something specific */
7+
//// property: number;
8+
//// }
9+
//// function stringExample(e: StringExample) {
10+
//// console.log(e./*property*/property);
11+
//// console.log(e./*string*/anything);
12+
//// }
13+
14+
verify.quickInfoAt("property", "(property) StringExample.property: number", 'Something specific');
15+
verify.quickInfoAt("string", "(index) StringExample[string]: any", "Something generic");
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
///<reference path="fourslash.ts" />
2+
3+
//// class MultipleClass {
4+
//// /** Something generic */
5+
//// [key: number | symbol | `data-${string}` | `data-${number}`]: string;
6+
//// }
7+
//// function multipleClass(e: typeof MultipleClass) {
8+
//// console.log(e./*multipleClass*/anything);
9+
//// }
10+
11+
verify.quickInfoAt("multipleClass", "any");
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
///<reference path="fourslash.ts" />
2+
3+
//// type AliasExample = {
4+
//// /** Something generic */
5+
//// [p: string]: string;
6+
//// /** Something else */
7+
//// [key: `any${string}`]: string;
8+
//// }
9+
//// function aliasExample(e: AliasExample) {
10+
//// console.log(e./*alias*/anything);
11+
//// }
12+
13+
verify.quickInfoAt("alias", "(index) AliasExample[string | `any${string}`]: string", "Something generic\nSomething else");
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
///<reference path="fourslash.ts" />
2+
3+
//// type SymbolAlias = {
4+
//// /** Something generic */
5+
//// [p: symbol]: string;
6+
//// }
7+
//// function symbolAlias(e: SymbolAlias) {
8+
//// console.log(e./*symbolAlias*/anything);
9+
//// }
10+
11+
verify.quickInfoAt("symbolAlias", "any");
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
///<reference path="fourslash.ts" />
2+
3+
//// interface SymbolExample {
4+
//// /** Something generic */
5+
//// [key: symbol]: string;
6+
//// }
7+
//// function symbolExample(e: SymbolExample) {
8+
//// console.log(e./*symbol*/anything);
9+
//// }
10+
11+
verify.quickInfoAt("symbol", "any")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
///<reference path="fourslash.ts" />
2+
3+
//// interface LiteralExample {
4+
//// /** Something generic */
5+
//// [key: `data-${string}`]: string;
6+
//// /** Something else */
7+
//// [key: `prefix${number}`]: number;
8+
//// }
9+
//// function literalExample(e: LiteralExample) {
10+
//// console.log(e./*literal*/anything);
11+
//// }
12+
13+
verify.quickInfoAt("literal", "any");
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
///<reference path="fourslash.ts" />
2+
3+
//// interface MultipleExample {
4+
//// /** Something generic */
5+
//// [key: string | number | symbol]: string;
6+
//// }
7+
//// function multipleExample(e: MultipleExample) {
8+
//// console.log(e./*multiple*/anything);
9+
//// }
10+
11+
verify.quickInfoAt("multiple", "(index) MultipleExample[string | number | symbol]: string", "Something generic");
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
///<reference path="fourslash.ts" />
2+
3+
//// interface Multiple1Example {
4+
//// /** Something generic */
5+
//// [key: number | symbol | `data-${string}` | `data-${number}`]: string;
6+
//// }
7+
//// function multiple1Example(e: Multiple1Example) {
8+
//// console.log(e./*multiple1*/anything);
9+
//// }
10+
11+
verify.quickInfoAt("multiple1", "any");
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// /<reference path="fourslash.ts" />
2+
3+
//// interface Literal1Example {
4+
//// [key: `prefix${string}`]: number | string;
5+
//// /** Something else */
6+
//// [key: `prefix${number}`]: number;
7+
//// }
8+
//// function literal1Example(e: Literal1Example) {
9+
//// console.log(e./*literal1*/prefixMember);
10+
//// console.log(e./*literal2*/anything);
11+
//// console.log(e./*literal3*/prefix0);
12+
//// }
13+
14+
verify.quickInfoAt("literal1", "(index) Literal1Example[`prefix${string}`]: string | number");
15+
verify.quickInfoAt("literal2", "any");
16+
verify.quickInfoAt("literal3", "(index) Literal1Example[`prefix${string}` | `prefix${number}`]: number", "Something else");
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
///<reference path="fourslash.ts" />
2+
3+
//// class StringClass {
4+
//// /** Something generic */
5+
//// static [p: string]: any;
6+
//// }
7+
//// function stringClass(e: typeof StringClass) {
8+
//// console.log(e./*stringClass*/anything);
9+
//// }
10+
11+
verify.quickInfoAt("stringClass", "(index) StringClass[string]: any", "Something generic");
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
///<reference path="fourslash.ts" />
2+
3+
//// class SymbolClass {
4+
//// /** Something generic */
5+
//// static [p: symbol]: any;
6+
//// }
7+
//// function symbolClass(e: typeof SymbolClass) {
8+
//// console.log(e./*symbolClass*/anything);
9+
//// }
10+
11+
verify.quickInfoAt("symbolClass", "any");
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
///<reference path="fourslash.ts" />
2+
3+
//// class LiteralClass {
4+
//// /** Something generic */
5+
//// static [key: `prefix${string}`]: any;
6+
//// /** Something else */
7+
//// static [key: `prefix${number}`]: number;
8+
//// }
9+
//// function literalClass(e: typeof LiteralClass) {
10+
//// console.log(e./*literal1Class*/prefixMember);
11+
//// console.log(e./*literal2Class*/anything);
12+
//// console.log(e./*literal3Class*/prefix0);
13+
//// }
14+
15+
verify.quickInfoAt("literal1Class", "(index) LiteralClass[`prefix${string}`]: any", "Something generic");
16+
verify.quickInfoAt("literal2Class", "any");
17+
verify.quickInfoAt("literal3Class", "(index) LiteralClass[`prefix${string}` | `prefix${number}`]: any", "Something generic\nSomething else")

0 commit comments

Comments
 (0)
Please sign in to comment.