diff --git a/internal/ast/ast.go b/internal/ast/ast.go index 7d7dea31d3..e991bd08ad 100644 --- a/internal/ast/ast.go +++ b/internal/ast/ast.go @@ -1067,6 +1067,48 @@ func (n *Node) Elements() []*Node { return nil } +func (n *Node) postfixToken() *Node { + switch n.Kind { + case KindEnumMember: + return n.AsEnumMember().PostfixToken + case KindPropertyAssignment: + return n.AsPropertyAssignment().PostfixToken + case KindShorthandPropertyAssignment: + return n.AsShorthandPropertyAssignment().PostfixToken + case KindPropertySignature: + return n.AsPropertySignatureDeclaration().PostfixToken + case KindPropertyDeclaration: + return n.AsPropertyDeclaration().PostfixToken + case KindMethodSignature: + return n.AsMethodSignatureDeclaration().PostfixToken + case KindMethodDeclaration: + return n.AsMethodDeclaration().PostfixToken + case KindGetAccessor: + return n.AsGetAccessorDeclaration().PostfixToken + case KindSetAccessor: + return n.AsSetAccessorDeclaration().PostfixToken + } + return nil +} + +func (n *Node) QuestionToken() *TokenNode { + switch n.Kind { + case KindParameter: + return n.AsParameterDeclaration().QuestionToken + case KindConditionalExpression: + return n.AsConditionalExpression().QuestionToken + case KindMappedType: + return n.AsMappedTypeNode().QuestionToken + case KindNamedTupleMember: + return n.AsNamedTupleMember().QuestionToken + } + postfix := n.postfixToken() + if postfix != nil && postfix.Kind == KindQuestionToken { + return postfix + } + return nil +} + func (n *Node) QuestionDotToken() *Node { switch n.Kind { case KindElementAccessExpression: diff --git a/internal/checker/checker.go b/internal/checker/checker.go index 9844cbc289..1fa8c4360c 100644 --- a/internal/checker/checker.go +++ b/internal/checker/checker.go @@ -12907,7 +12907,7 @@ func (c *Checker) getSpreadType(left *Type, right *Type, symbol *ast.Symbol, obj func (c *Checker) getIndexInfoWithReadonly(info *IndexInfo, readonly bool) *IndexInfo { if info.isReadonly != readonly { - return c.newIndexInfo(info.keyType, info.valueType, readonly, info.declaration) + return c.newIndexInfo(info.keyType, info.valueType, readonly, info.declaration, info.components) } return info } @@ -12928,7 +12928,7 @@ func (c *Checker) getUnionIndexInfos(types []*Type) []*IndexInfo { return c.getIndexTypeOfType(t, indexType) })) isReadonly := core.Some(types, func(t *Type) bool { return c.getIndexInfoOfType(t, indexType).isReadonly }) - result = append(result, c.newIndexInfo(indexType, valueType, isReadonly, nil)) + result = append(result, c.newIndexInfo(indexType, valueType, isReadonly, nil, nil)) } } return result @@ -17179,7 +17179,7 @@ func (c *Checker) getTypeFromObjectBindingPattern(pattern *ast.Node, includePatt for _, e := range pattern.AsBindingPattern().Elements.Nodes { name := e.PropertyNameOrName() if hasDotDotDotToken(e) { - stringIndexInfo = c.newIndexInfo(c.stringType, c.anyType, false /*isReadonly*/, nil) + stringIndexInfo = c.newIndexInfo(c.stringType, c.anyType, false /*isReadonly*/, nil, nil) continue } exprType := c.getLiteralTypeFromPropertyName(name) @@ -17580,7 +17580,7 @@ func (c *Checker) getWidenedTypeOfObjectLiteral(t *Type, context *WideningContex } } result := c.newAnonymousType(t.symbol, members, nil, nil, core.SameMap(c.getIndexInfosOfType(t), func(info *IndexInfo) *IndexInfo { - return c.newIndexInfo(info.keyType, c.getWidenedType(info.valueType), info.isReadonly, info.declaration) + return c.newIndexInfo(info.keyType, c.getWidenedType(info.valueType), info.isReadonly, info.declaration, info.components) })) // Retain js literal flag through widening result.objectFlags |= t.objectFlags & (ObjectFlagsJSLiteral | ObjectFlagsNonInferrableType) @@ -18187,7 +18187,7 @@ func (c *Checker) findApplicableIndexInfo(indexInfos []*IndexInfo, keyType *Type isReadonly = false } } - return c.newIndexInfo(c.unknownType, c.getIntersectionType(types), isReadonly, nil) + return c.newIndexInfo(c.unknownType, c.getIntersectionType(types), isReadonly, nil, nil) } } @@ -18794,7 +18794,7 @@ func (c *Checker) getIndexInfosOfIndexSymbol(indexSymbol *ast.Symbol, siblingSym } forEachType(c.getTypeFromTypeNode(typeNode), func(keyType *Type) { if c.isValidIndexKeyType(keyType) && findIndexInfo(indexInfos, keyType) == nil { - indexInfo := c.newIndexInfo(keyType, valueType, HasModifier(declaration, ast.ModifierFlagsReadonly), declaration) + indexInfo := c.newIndexInfo(keyType, valueType, HasModifier(declaration, ast.ModifierFlagsReadonly), declaration, nil) indexInfos = append(indexInfos, indexInfo) } }) @@ -18861,18 +18861,22 @@ func (c *Checker) getIndexInfosOfIndexSymbol(indexSymbol *ast.Symbol, siblingSym // NOTE: currently does not make pattern literal indexers, eg `${number}px` func (c *Checker) getObjectLiteralIndexInfo(isReadonly bool, properties []*ast.Symbol, keyType *Type) *IndexInfo { var propTypes []*Type + var components []*ast.Node for _, prop := range properties { if keyType == c.stringType && !c.isSymbolWithSymbolName(prop) || keyType == c.numberType && c.isSymbolWithNumericName(prop) || keyType == c.esSymbolType && c.isSymbolWithSymbolName(prop) { propTypes = append(propTypes, c.getTypeOfSymbol(prop)) + if c.isSymbolWithComputedName(prop) { + components = append(components, prop.Declarations[0]) + } } } unionType := c.undefinedType if len(propTypes) != 0 { unionType = c.getUnionTypeEx(propTypes, UnionReductionSubtype, nil, nil) } - return c.newIndexInfo(keyType, unionType, isReadonly, nil /*declaration*/) + return c.newIndexInfo(keyType, unionType, isReadonly, nil /*declaration*/, components) } func (c *Checker) isSymbolWithSymbolName(symbol *ast.Symbol) bool { @@ -18897,6 +18901,14 @@ func (c *Checker) isSymbolWithNumericName(symbol *ast.Symbol) bool { return false } +func (c *Checker) isSymbolWithComputedName(symbol *ast.Symbol) bool { + if len(symbol.Declarations) != 0 { + name := symbol.Declarations[0].Name() + return name != nil && ast.IsComputedPropertyName(name) + } + return false +} + func (c *Checker) isNumericName(name *ast.Node) bool { switch name.Kind { case ast.KindComputedPropertyName: @@ -19768,7 +19780,7 @@ func (c *Checker) instantiateIndexInfo(info *IndexInfo, m *TypeMapper) *IndexInf if newValueType == info.valueType { return info } - return c.newIndexInfo(info.keyType, newValueType, info.isReadonly, info.declaration) + return c.newIndexInfo(info.keyType, newValueType, info.isReadonly, info.declaration, info.components) } func (c *Checker) resolveAnonymousTypeMembers(t *Type) { @@ -20086,7 +20098,7 @@ func (c *Checker) resolveMappedTypeMembers(t *Type) { propType := c.instantiateType(templateType, appendTypeMapping(t.AsMappedType().mapper, typeParameter, keyType)) modifiersIndexInfo := c.getApplicableIndexInfo(modifiersType, propNameType) isReadonly := templateModifiers&MappedTypeModifiersIncludeReadonly != 0 || templateModifiers&MappedTypeModifiersExcludeReadonly == 0 && modifiersIndexInfo != nil && modifiersIndexInfo.isReadonly - indexInfo := c.newIndexInfo(indexKeyType, propType, isReadonly, nil) + indexInfo := c.newIndexInfo(indexKeyType, propType, isReadonly, nil, nil) indexInfos = c.appendIndexInfo(indexInfos, indexInfo, true /*union*/) } } @@ -20479,7 +20491,7 @@ func (c *Checker) appendIndexInfo(indexInfos []*IndexInfo, newInfo *IndexInfo, u valueType = c.getIntersectionType([]*Type{info.valueType, newInfo.valueType}) isReadonly = info.isReadonly && newInfo.isReadonly } - indexInfos[i] = c.newIndexInfo(info.keyType, valueType, isReadonly, nil) + indexInfos[i] = c.newIndexInfo(info.keyType, valueType, isReadonly, nil, nil) return indexInfos } } @@ -24316,12 +24328,13 @@ func (c *Checker) newSignature(flags SignatureFlags, declaration *ast.Node, type return sig } -func (c *Checker) newIndexInfo(keyType *Type, valueType *Type, isReadonly bool, declaration *ast.Node) *IndexInfo { +func (c *Checker) newIndexInfo(keyType *Type, valueType *Type, isReadonly bool, declaration *ast.Node, components []*ast.Node) *IndexInfo { info := c.indexInfoPool.New() info.keyType = keyType info.valueType = valueType info.isReadonly = isReadonly info.declaration = declaration + info.components = components return info } diff --git a/internal/checker/emitresolver.go b/internal/checker/emitresolver.go index df7011e5c4..40bd253bc2 100644 --- a/internal/checker/emitresolver.go +++ b/internal/checker/emitresolver.go @@ -1010,9 +1010,44 @@ func (r *emitResolver) CreateLateBoundIndexSignatures(emitContext *printer.EmitC if info == r.checker.anyBaseTypeIndexInfo { continue // inherited, but looks like a late-bound signature because it has no declarations } - // if info.components { - // !!! TODO: Complete late-bound index info support - getObjectLiteralIndexInfo does not yet add late bound components to index signatures - // } + if len(info.components) != 0 { + // !!! TODO: Complete late-bound index info support - getObjectLiteralIndexInfo does not yet add late bound components to index signatures + allComponentComputedNamesSerializable := enclosingDeclaration != nil && core.Every(info.components, func(c *ast.Node) bool { + return c.Name() != nil && + ast.IsComputedPropertyName(c.Name()) && + ast.IsEntityNameExpression(c.Name().AsComputedPropertyName().Expression) && + r.isEntityNameVisible(c.Name().AsComputedPropertyName().Expression, enclosingDeclaration, false).Accessibility == printer.SymbolAccessibilityAccessible + }) + if allComponentComputedNamesSerializable { + for _, c := range info.components { + if r.checker.hasLateBindableName(c) { + // skip late bound props that contribute to the index signature - they'll be preserved via other means + continue + } + + firstIdentifier := ast.GetFirstIdentifier(c.Name().Expression()) + name := r.checker.resolveName(firstIdentifier, firstIdentifier.Text(), ast.SymbolFlagsValue|ast.SymbolFlagsExportValue, nil /*nameNotFoundMessage*/, true /*isUse*/, false /*excludeGlobals*/) + if name != nil { + tracker.TrackSymbol(name, enclosingDeclaration, ast.SymbolFlagsValue) + } + + mods := core.IfElse(isStatic, []*ast.Node{emitContext.Factory.NewModifier(ast.KindStaticKeyword)}, nil) + if info.isReadonly { + mods = append(mods, emitContext.Factory.NewModifier(ast.KindReadonlyKeyword)) + } + + decl := emitContext.Factory.NewPropertyDeclaration( + core.IfElse(mods != nil, emitContext.Factory.NewModifierList(mods), nil), + c.Name(), + c.QuestionToken(), + requestNodeBuilder.TypeToTypeNode(r.checker.getTypeOfSymbol(c.Symbol()), enclosingDeclaration, flags, internalFlags, tracker), + nil, + ) + result = append(result, decl) + } + continue + } + } node := requestNodeBuilder.IndexInfoToIndexSignatureDeclaration(info, enclosingDeclaration, flags, internalFlags, tracker) if node != nil && isStatic { modNodes := []*ast.Node{emitContext.Factory.NewModifier(ast.KindStaticKeyword)} diff --git a/internal/checker/inference.go b/internal/checker/inference.go index 2d8db851cc..d395f03a98 100644 --- a/internal/checker/inference.go +++ b/internal/checker/inference.go @@ -1035,7 +1035,7 @@ func (c *Checker) resolveReverseMappedTypeMembers(t *Type) { optionalMask := core.IfElse(modifiers&MappedTypeModifiersIncludeOptional != 0, 0, ast.SymbolFlagsOptional) var indexInfos []*IndexInfo if indexInfo != nil { - indexInfos = []*IndexInfo{c.newIndexInfo(c.stringType, core.OrElse(c.inferReverseMappedType(indexInfo.valueType, r.mappedType, r.constraintType), c.unknownType), readonlyMask && indexInfo.isReadonly, nil)} + indexInfos = []*IndexInfo{c.newIndexInfo(c.stringType, core.OrElse(c.inferReverseMappedType(indexInfo.valueType, r.mappedType, r.constraintType), c.unknownType), readonlyMask && indexInfo.isReadonly, nil, nil)} } members := make(ast.SymbolTable) limitedConstraint := c.getLimitedConstraint(t) @@ -1174,7 +1174,7 @@ func (c *Checker) createEmptyObjectTypeFromStringLiteral(t *Type) *Type { } var indexInfos []*IndexInfo if t.flags&TypeFlagsString != 0 { - indexInfos = []*IndexInfo{c.newIndexInfo(c.stringType, c.emptyObjectType, false /*isReadonly*/, nil)} + indexInfos = []*IndexInfo{c.newIndexInfo(c.stringType, c.emptyObjectType, false /*isReadonly*/, nil, nil)} } return c.newAnonymousType(nil, members, nil, nil, indexInfos) } diff --git a/internal/checker/types.go b/internal/checker/types.go index 5fd4b15830..0a66c81c2f 100644 --- a/internal/checker/types.go +++ b/internal/checker/types.go @@ -1198,7 +1198,8 @@ type IndexInfo struct { keyType *Type valueType *Type isReadonly bool - declaration *ast.Node // IndexSignatureDeclaration + declaration *ast.Node // IndexSignatureDeclaration + components []*ast.Node // ElementWithComputedPropertyName } /** diff --git a/testdata/baselines/reference/submodule/compiler/classNonUniqueSymbolMethodHasSymbolIndexer.js b/testdata/baselines/reference/submodule/compiler/classNonUniqueSymbolMethodHasSymbolIndexer.js index b62a61483a..d2adefb662 100644 --- a/testdata/baselines/reference/submodule/compiler/classNonUniqueSymbolMethodHasSymbolIndexer.js +++ b/testdata/baselines/reference/submodule/compiler/classNonUniqueSymbolMethodHasSymbolIndexer.js @@ -27,8 +27,9 @@ export const Mixer = Mix(class { //// [classNonUniqueSymbolMethodHasSymbolIndexer.d.ts] +declare const a: symbol; export declare class A { - [x: symbol]: () => number; + [a]: () => number; } export declare const Mixer: { new (): { @@ -37,3 +38,4 @@ export declare const Mixer: { } & (new (...args: any[]) => { mixed: true; }); +export {}; diff --git a/testdata/baselines/reference/submodule/compiler/classNonUniqueSymbolMethodHasSymbolIndexer.js.diff b/testdata/baselines/reference/submodule/compiler/classNonUniqueSymbolMethodHasSymbolIndexer.js.diff index 3fc3e62d5f..d64056e43a 100644 --- a/testdata/baselines/reference/submodule/compiler/classNonUniqueSymbolMethodHasSymbolIndexer.js.diff +++ b/testdata/baselines/reference/submodule/compiler/classNonUniqueSymbolMethodHasSymbolIndexer.js.diff @@ -1,13 +1,6 @@ --- old.classNonUniqueSymbolMethodHasSymbolIndexer.js +++ new.classNonUniqueSymbolMethodHasSymbolIndexer.js -@@= skipped -26, +26 lines =@@ - - - //// [classNonUniqueSymbolMethodHasSymbolIndexer.d.ts] --declare const a: symbol; - export declare class A { -- [a]: () => number; -+ [x: symbol]: () => number; +@@= skipped -32, +32 lines =@@ } export declare const Mixer: { new (): { @@ -15,6 +8,4 @@ + [x: symbol]: () => number; }; } & (new (...args: any[]) => { - mixed: true; - }); --export {}; \ No newline at end of file + mixed: true; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitAnyComputedPropertyInClass.js b/testdata/baselines/reference/submodule/compiler/declarationEmitAnyComputedPropertyInClass.js index 08668626a9..96def849ed 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitAnyComputedPropertyInClass.js +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitAnyComputedPropertyInClass.js @@ -24,6 +24,7 @@ exports.C = C; //// [main.d.ts] +import Test from "abcdefgh"; export declare class C { - [x: number]: () => void; + [Test.someKey]: () => void; } diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitAnyComputedPropertyInClass.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitAnyComputedPropertyInClass.js.diff index 3d15f16ec7..709671dfb3 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitAnyComputedPropertyInClass.js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitAnyComputedPropertyInClass.js.diff @@ -8,13 +8,4 @@ +const abcdefgh_1 = require("abcdefgh"); class C { [abcdefgh_1.default.someKey]() { } - ; -@@= skipped -9, +9 lines =@@ - - - //// [main.d.ts] --import Test from "abcdefgh"; - export declare class C { -- [Test.someKey]: () => void; -+ [x: number]: () => void; - } \ No newline at end of file + ; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitComputedNameWithQuestionToken.js b/testdata/baselines/reference/submodule/compiler/declarationEmitComputedNameWithQuestionToken.js index 8eb1c64ce6..c852683733 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitComputedNameWithQuestionToken.js +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitComputedNameWithQuestionToken.js @@ -29,6 +29,6 @@ exports.a = (new WithData())["ahahahaahah"](); //// [declarationEmitComputedNameWithQuestionToken.d.ts] export declare const dataSomething: `data-${string}`; export declare class WithData { - [x: string]: () => string; + [dataSomething]?: () => string; } export declare const a: string; diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitComputedNameWithQuestionToken.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitComputedNameWithQuestionToken.js.diff deleted file mode 100644 index 601c50ed08..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitComputedNameWithQuestionToken.js.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.declarationEmitComputedNameWithQuestionToken.js -+++ new.declarationEmitComputedNameWithQuestionToken.js -@@= skipped -28, +28 lines =@@ - //// [declarationEmitComputedNameWithQuestionToken.d.ts] - export declare const dataSomething: `data-${string}`; - export declare class WithData { -- [dataSomething]?: () => string; -+ [x: string]: () => string; - } - export declare const a: string; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitMultipleComputedNamesSameDomain.js b/testdata/baselines/reference/submodule/compiler/declarationEmitMultipleComputedNamesSameDomain.js index b6044cbda9..985bc81218 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitMultipleComputedNamesSameDomain.js +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitMultipleComputedNamesSameDomain.js @@ -21,9 +21,10 @@ exports.Test = Test; //// [declarationEmitMultipleComputedNamesSameDomain.d.ts] +declare const x: string; declare const y: "y"; export declare class Test { - [x: string]: number; + [x]: number; [y]: number; } export {}; diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitMultipleComputedNamesSameDomain.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitMultipleComputedNamesSameDomain.js.diff index 595c7bbd25..cb0e618742 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitMultipleComputedNamesSameDomain.js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitMultipleComputedNamesSameDomain.js.diff @@ -19,12 +19,4 @@ -_a = x, _b = y; - //// [declarationEmitMultipleComputedNamesSameDomain.d.ts] --declare const x: string; - declare const y: "y"; - export declare class Test { -- [x]: number; -+ [x: string]: number; - [y]: number; - } - export {}; \ No newline at end of file + //// [declarationEmitMultipleComputedNamesSameDomain.d.ts] \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitSimpleComputedNames1.js b/testdata/baselines/reference/submodule/compiler/declarationEmitSimpleComputedNames1.js index d34e9d34dd..22b7159d60 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitSimpleComputedNames1.js +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitSimpleComputedNames1.js @@ -73,13 +73,18 @@ export declare const fieldName: string; export declare const conatainer: { [x: string]: () => string; }; +declare const classFieldName: string; +declare const otherField: string; +declare const staticField: string; export declare class Holder { - static [x: string]: Holder | (() => { + static [staticField]: () => { static: boolean; - }) | (() => { + }; + static [staticField]: () => { static: string; - }); - [x: string]: (() => string) | (() => number); + }; + [classFieldName]: () => string; + [otherField]: () => number; } /** * Could be `"prototype"`, so all static string indexers include the instance type @@ -90,3 +95,4 @@ export declare const staticLookup: Holder | (() => { static: string; }); export declare const instanceLookup: (() => string) | (() => number); +export {}; diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitSimpleComputedNames1.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitSimpleComputedNames1.js.diff index ff455c9ac1..9caf44fdeb 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitSimpleComputedNames1.js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitSimpleComputedNames1.js.diff @@ -7,27 +7,5 @@ - [fieldName]: () => string; + [x: string]: () => string; }; --declare const classFieldName: string; --declare const otherField: string; --declare const staticField: string; - export declare class Holder { -- static [staticField]: () => { -+ static [x: string]: Holder | (() => { - static: boolean; -- }; -- static [staticField]: () => { -+ }) | (() => { - static: string; -- }; -- [classFieldName]: () => string; -- [otherField]: () => number; -+ }); -+ [x: string]: (() => string) | (() => number); - } - /** - * Could be `"prototype"`, so all static string indexers include the instance type -@@= skipped -24, +19 lines =@@ - static: string; - }); - export declare const instanceLookup: (() => string) | (() => number); --export {}; \ No newline at end of file + declare const classFieldName: string; + declare const otherField: string; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsClasses.js b/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsClasses.js index 5b6872ec8b..daf465c885 100644 --- a/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsClasses.js +++ b/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsClasses.js @@ -113,9 +113,13 @@ export declare class Cls { set getSetOk3(value: number); } declare let noAnnotationStringName: string; +declare let noParamAnnotationStringName: string; declare const noAnnotationLiteralName = "noAnnotationLiteralName"; export declare class C { - [x: string]: any; + [noAnnotationStringName]: () => void; + [noParamAnnotationStringName]: (v: any) => void; + [noAnnotationStringName]: number; + [noParamAnnotationStringName]: any; [x: number]: number; } export interface I { diff --git a/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsClasses.js.diff b/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsClasses.js.diff index 8c37d0e27a..b32b1d0c33 100644 --- a/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsClasses.js.diff +++ b/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsClasses.js.diff @@ -25,9 +25,13 @@ + set getSetOk3(value: number); +} +declare let noAnnotationStringName: string; ++declare let noParamAnnotationStringName: string; +declare const noAnnotationLiteralName = "noAnnotationLiteralName"; +export declare class C { -+ [x: string]: any; ++ [noAnnotationStringName]: () => void; ++ [noParamAnnotationStringName]: (v: any) => void; ++ [noAnnotationStringName]: number; ++ [noParamAnnotationStringName]: any; + [x: number]: number; +} +export interface I { diff --git a/testdata/baselines/reference/submodule/conformance/overrideDynamicName1(noimplicitoverride=false).js b/testdata/baselines/reference/submodule/conformance/overrideDynamicName1(noimplicitoverride=false).js index 9066e8c7d5..22e2a11cfe 100644 --- a/testdata/baselines/reference/submodule/conformance/overrideDynamicName1(noimplicitoverride=false).js +++ b/testdata/baselines/reference/submodule/conformance/overrideDynamicName1(noimplicitoverride=false).js @@ -31,19 +31,19 @@ class Derived3 extends Base3 { //// [overrideDynamicName1.d.ts] declare let prop: string; declare class Base1 { - [x: string]: () => void; + [prop]: () => void; } declare class Derived1 extends Base1 { - [x: string]: () => void; + [prop]: () => void; } declare class Base2 { - [x: string]: () => void; + [prop]: () => void; } declare class Derived2 extends Base2 { - [x: string]: () => void; + [prop]: () => void; } declare class Base3 { } declare class Derived3 extends Base3 { - [x: string]: () => void; + [prop]: () => void; } diff --git a/testdata/baselines/reference/submodule/conformance/overrideDynamicName1(noimplicitoverride=false).js.diff b/testdata/baselines/reference/submodule/conformance/overrideDynamicName1(noimplicitoverride=false).js.diff deleted file mode 100644 index 34284ac0bb..0000000000 --- a/testdata/baselines/reference/submodule/conformance/overrideDynamicName1(noimplicitoverride=false).js.diff +++ /dev/null @@ -1,27 +0,0 @@ ---- old.overrideDynamicName1(noimplicitoverride=false).js -+++ new.overrideDynamicName1(noimplicitoverride=false).js -@@= skipped -30, +30 lines =@@ - //// [overrideDynamicName1.d.ts] - declare let prop: string; - declare class Base1 { -- [prop]: () => void; -+ [x: string]: () => void; - } - declare class Derived1 extends Base1 { -- [prop]: () => void; -+ [x: string]: () => void; - } - declare class Base2 { -- [prop]: () => void; -+ [x: string]: () => void; - } - declare class Derived2 extends Base2 { -- [prop]: () => void; -+ [x: string]: () => void; - } - declare class Base3 { - } - declare class Derived3 extends Base3 { -- [prop]: () => void; -+ [x: string]: () => void; - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/overrideDynamicName1(noimplicitoverride=true).js b/testdata/baselines/reference/submodule/conformance/overrideDynamicName1(noimplicitoverride=true).js index 9066e8c7d5..22e2a11cfe 100644 --- a/testdata/baselines/reference/submodule/conformance/overrideDynamicName1(noimplicitoverride=true).js +++ b/testdata/baselines/reference/submodule/conformance/overrideDynamicName1(noimplicitoverride=true).js @@ -31,19 +31,19 @@ class Derived3 extends Base3 { //// [overrideDynamicName1.d.ts] declare let prop: string; declare class Base1 { - [x: string]: () => void; + [prop]: () => void; } declare class Derived1 extends Base1 { - [x: string]: () => void; + [prop]: () => void; } declare class Base2 { - [x: string]: () => void; + [prop]: () => void; } declare class Derived2 extends Base2 { - [x: string]: () => void; + [prop]: () => void; } declare class Base3 { } declare class Derived3 extends Base3 { - [x: string]: () => void; + [prop]: () => void; } diff --git a/testdata/baselines/reference/submodule/conformance/overrideDynamicName1(noimplicitoverride=true).js.diff b/testdata/baselines/reference/submodule/conformance/overrideDynamicName1(noimplicitoverride=true).js.diff deleted file mode 100644 index 2e165cc50c..0000000000 --- a/testdata/baselines/reference/submodule/conformance/overrideDynamicName1(noimplicitoverride=true).js.diff +++ /dev/null @@ -1,27 +0,0 @@ ---- old.overrideDynamicName1(noimplicitoverride=true).js -+++ new.overrideDynamicName1(noimplicitoverride=true).js -@@= skipped -30, +30 lines =@@ - //// [overrideDynamicName1.d.ts] - declare let prop: string; - declare class Base1 { -- [prop]: () => void; -+ [x: string]: () => void; - } - declare class Derived1 extends Base1 { -- [prop]: () => void; -+ [x: string]: () => void; - } - declare class Base2 { -- [prop]: () => void; -+ [x: string]: () => void; - } - declare class Derived2 extends Base2 { -- [prop]: () => void; -+ [x: string]: () => void; - } - declare class Base3 { - } - declare class Derived3 extends Base3 { -- [prop]: () => void; -+ [x: string]: () => void; - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/overrideLateBindableIndexSignature1(noimplicitoverride=false).js b/testdata/baselines/reference/submodule/conformance/overrideLateBindableIndexSignature1(noimplicitoverride=false).js index d02cbd16d4..17d12eb6de 100644 --- a/testdata/baselines/reference/submodule/conformance/overrideLateBindableIndexSignature1(noimplicitoverride=false).js +++ b/testdata/baselines/reference/submodule/conformance/overrideLateBindableIndexSignature1(noimplicitoverride=false).js @@ -31,19 +31,19 @@ class Derived3 extends Base3 { //// [overrideLateBindableIndexSignature1.d.ts] declare const sym: symbol; declare class Base1 { - [x: symbol]: () => void; + [sym]: () => void; } declare class Derived1 extends Base1 { - [x: symbol]: () => void; + [sym]: () => void; } declare class Base2 { - [x: symbol]: () => void; + [sym]: () => void; } declare class Derived2 extends Base2 { - [x: symbol]: () => void; + [sym]: () => void; } declare class Base3 { } declare class Derived3 extends Base3 { - [x: symbol]: () => void; + [sym]: () => void; } diff --git a/testdata/baselines/reference/submodule/conformance/overrideLateBindableIndexSignature1(noimplicitoverride=false).js.diff b/testdata/baselines/reference/submodule/conformance/overrideLateBindableIndexSignature1(noimplicitoverride=false).js.diff deleted file mode 100644 index c75aebda7f..0000000000 --- a/testdata/baselines/reference/submodule/conformance/overrideLateBindableIndexSignature1(noimplicitoverride=false).js.diff +++ /dev/null @@ -1,27 +0,0 @@ ---- old.overrideLateBindableIndexSignature1(noimplicitoverride=false).js -+++ new.overrideLateBindableIndexSignature1(noimplicitoverride=false).js -@@= skipped -30, +30 lines =@@ - //// [overrideLateBindableIndexSignature1.d.ts] - declare const sym: symbol; - declare class Base1 { -- [sym]: () => void; -+ [x: symbol]: () => void; - } - declare class Derived1 extends Base1 { -- [sym]: () => void; -+ [x: symbol]: () => void; - } - declare class Base2 { -- [sym]: () => void; -+ [x: symbol]: () => void; - } - declare class Derived2 extends Base2 { -- [sym]: () => void; -+ [x: symbol]: () => void; - } - declare class Base3 { - } - declare class Derived3 extends Base3 { -- [sym]: () => void; -+ [x: symbol]: () => void; - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/overrideLateBindableIndexSignature1(noimplicitoverride=true).js b/testdata/baselines/reference/submodule/conformance/overrideLateBindableIndexSignature1(noimplicitoverride=true).js index d02cbd16d4..17d12eb6de 100644 --- a/testdata/baselines/reference/submodule/conformance/overrideLateBindableIndexSignature1(noimplicitoverride=true).js +++ b/testdata/baselines/reference/submodule/conformance/overrideLateBindableIndexSignature1(noimplicitoverride=true).js @@ -31,19 +31,19 @@ class Derived3 extends Base3 { //// [overrideLateBindableIndexSignature1.d.ts] declare const sym: symbol; declare class Base1 { - [x: symbol]: () => void; + [sym]: () => void; } declare class Derived1 extends Base1 { - [x: symbol]: () => void; + [sym]: () => void; } declare class Base2 { - [x: symbol]: () => void; + [sym]: () => void; } declare class Derived2 extends Base2 { - [x: symbol]: () => void; + [sym]: () => void; } declare class Base3 { } declare class Derived3 extends Base3 { - [x: symbol]: () => void; + [sym]: () => void; } diff --git a/testdata/baselines/reference/submodule/conformance/overrideLateBindableIndexSignature1(noimplicitoverride=true).js.diff b/testdata/baselines/reference/submodule/conformance/overrideLateBindableIndexSignature1(noimplicitoverride=true).js.diff deleted file mode 100644 index 4e4a90ffc6..0000000000 --- a/testdata/baselines/reference/submodule/conformance/overrideLateBindableIndexSignature1(noimplicitoverride=true).js.diff +++ /dev/null @@ -1,27 +0,0 @@ ---- old.overrideLateBindableIndexSignature1(noimplicitoverride=true).js -+++ new.overrideLateBindableIndexSignature1(noimplicitoverride=true).js -@@= skipped -30, +30 lines =@@ - //// [overrideLateBindableIndexSignature1.d.ts] - declare const sym: symbol; - declare class Base1 { -- [sym]: () => void; -+ [x: symbol]: () => void; - } - declare class Derived1 extends Base1 { -- [sym]: () => void; -+ [x: symbol]: () => void; - } - declare class Base2 { -- [sym]: () => void; -+ [x: symbol]: () => void; - } - declare class Derived2 extends Base2 { -- [sym]: () => void; -+ [x: symbol]: () => void; - } - declare class Base3 { - } - declare class Derived3 extends Base3 { -- [sym]: () => void; -+ [x: symbol]: () => void; - } \ No newline at end of file