Computed names in declarations files are resolved even when non-literal, preserve computed names when expressions are entity names (#60052)

This commit is contained in:
Wesley Wigham authored and GitHub committed 2025-01-24 11:44:54 -08:00
1 parent d1e2e50ff3
commit caf1aee269
113 files changed
+1235 -536

No files matched your search

+99 -13
View File
@@ -157,6 +157,7 @@ import {
ElementAccessChain,
ElementAccessExpression,
ElementFlags,
ElementWithComputedPropertyName,
EmitFlags,
EmitHint,
emitModuleKindIsNonNodeESM,
@@ -6935,7 +6936,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
}
function shouldWriteTypeOfFunctionSymbol() {
const isStaticMethodSymbol = !!(symbol.flags & SymbolFlags.Method) && // typeof static method
some(symbol.declarations, declaration => isStatic(declaration));
some(symbol.declarations, declaration => isStatic(declaration) && !isLateBindableIndexSignature(getNameOfDeclaration(declaration)!));
const isNonLocalFunctionSymbol = !!(symbol.flags & SymbolFlags.Function) &&
(symbol.parent || // is exported function symbol
forEach(symbol.declarations, declaration => declaration.parent.kind === SyntaxKind.SourceFile || declaration.parent.kind === SyntaxKind.ModuleBlock));
@@ -7292,6 +7293,37 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
return ids;
}
function indexInfoToObjectComputedNamesOrSignatureDeclaration(indexInfo: IndexInfo, context: NodeBuilderContext, typeNode: TypeNode | undefined): [IndexSignatureDeclaration] | PropertySignature[] {
if (indexInfo.components) {
// Index info is derived from object or class computed property names (plus explicit named members) - we can clone those instead of writing out the result computed index signature
const allComponentComputedNamesSerializable = every(indexInfo.components, e => {
return !!(e.name && isComputedPropertyName(e.name) && isEntityNameExpression(e.name.expression) && context.enclosingDeclaration && isEntityNameVisible(e.name.expression, context.enclosingDeclaration, /*shouldComputeAliasToMakeVisible*/ false)?.accessibility === SymbolAccessibility.Accessible);
});
if (allComponentComputedNamesSerializable) {
// Only use computed name serialization form if all components are visible and take the `a.b.c` form
const newComponents = filter(indexInfo.components, e => {
// skip late bound props that contribute to the index signature - they'll be created by property creation anyway
return !hasLateBindableName(e);
});
return map(newComponents, e => {
// Still need to track visibility even if we've already checked it to paint references as used
trackComputedName(e.name.expression as EntityNameExpression, context.enclosingDeclaration, context);
return setTextRange(
context,
factory.createPropertySignature(
indexInfo.isReadonly ? [factory.createModifier(SyntaxKind.ReadonlyKeyword)] : undefined,
e.name,
(isPropertySignature(e) || isPropertyDeclaration(e) || isMethodSignature(e) || isMethodDeclaration(e) || isGetAccessor(e) || isSetAccessor(e)) && e.questionToken ? factory.createToken(SyntaxKind.QuestionToken) : undefined,
typeNode || typeToTypeNodeHelper(getTypeOfSymbol(e.symbol), context),
),
e,
);
});
}
}
return [indexInfoToIndexSignatureDeclarationHelper(indexInfo, context, typeNode)];
}
function createTypeNodesFromResolvedType(resolvedType: ResolvedType): TypeElement[] | undefined {
if (checkTruncationLength(context)) {
if (context.flags & NodeBuilderFlags.NoTruncation) {
@@ -7308,7 +7340,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
typeElements.push(signatureToSignatureDeclarationHelper(signature, SyntaxKind.ConstructSignature, context) as ConstructSignatureDeclaration);
}
for (const info of resolvedType.indexInfos) {
typeElements.push(indexInfoToIndexSignatureDeclarationHelper(info, context, resolvedType.objectFlags & ObjectFlags.ReverseMapped ? createElidedInformationPlaceholder(context) : undefined));
typeElements.push(...indexInfoToObjectComputedNamesOrSignatureDeclaration(info, context, resolvedType.objectFlags & ObjectFlags.ReverseMapped ? createElidedInformationPlaceholder(context) : undefined));
}
const properties = resolvedType.properties;
@@ -8049,10 +8081,17 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
if (!context.tracker.canTrackSymbol) return;
// get symbol of the first identifier of the entityName
const firstIdentifier = getFirstIdentifier(accessExpression);
const name = resolveName(firstIdentifier, firstIdentifier.escapedText, SymbolFlags.Value | SymbolFlags.ExportValue, /*nameNotFoundMessage*/ undefined, /*isUse*/ true);
const name = resolveName(enclosingDeclaration, firstIdentifier.escapedText, SymbolFlags.Value | SymbolFlags.ExportValue, /*nameNotFoundMessage*/ undefined, /*isUse*/ true);
if (name) {
context.tracker.trackSymbol(name, enclosingDeclaration, SymbolFlags.Value);
}
else {
// Name does not resolve at target location, track symbol at dest location (should be inaccessible)
const fallback = resolveName(firstIdentifier, firstIdentifier.escapedText, SymbolFlags.Value | SymbolFlags.ExportValue, /*nameNotFoundMessage*/ undefined, /*isUse*/ true);
if (fallback) {
context.tracker.trackSymbol(fallback, enclosingDeclaration, SymbolFlags.Value);
}
}
}
function lookupSymbolChain(symbol: Symbol, context: NodeBuilderContext, meaning: SymbolFlags, yieldModuleSymbol?: boolean) {
@@ -16040,8 +16079,8 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
return symbolTable.get(InternalSymbolName.Index);
}
function createIndexInfo(keyType: Type, type: Type, isReadonly: boolean, declaration?: IndexSignatureDeclaration): IndexInfo {
return { keyType, type, isReadonly, declaration };
function createIndexInfo(keyType: Type, type: Type, isReadonly: boolean, declaration?: IndexSignatureDeclaration, components?: ElementWithComputedPropertyName[]): IndexInfo {
return { keyType, type, isReadonly, declaration, components };
}
function getIndexInfosOfSymbol(symbol: Symbol): IndexInfo[] {
@@ -19658,7 +19697,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
}
function getIndexInfoWithReadonly(info: IndexInfo, readonly: boolean) {
return info.isReadonly !== readonly ? createIndexInfo(info.keyType, info.type, readonly, info.declaration) : info;
return info.isReadonly !== readonly ? createIndexInfo(info.keyType, info.type, readonly, info.declaration, info.components) : info;
}
function createLiteralType(flags: TypeFlags, value: string | number | PseudoBigInt, symbol?: Symbol, regularType?: LiteralType) {
@@ -20566,7 +20605,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
}
function instantiateIndexInfo(info: IndexInfo, mapper: TypeMapper) {
return createIndexInfo(info.keyType, instantiateType(info.type, mapper), info.isReadonly, info.declaration);
return createIndexInfo(info.keyType, instantiateType(info.type, mapper), info.isReadonly, info.declaration, info.components);
}
// Returns true if the given expression contains (at any level of nesting) a function or arrow expression
@@ -25352,7 +25391,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
}
}
}
const result = createAnonymousType(type.symbol, members, emptyArray, emptyArray, sameMap(getIndexInfosOfType(type), info => createIndexInfo(info.keyType, getWidenedType(info.type), info.isReadonly)));
const result = createAnonymousType(type.symbol, members, emptyArray, emptyArray, sameMap(getIndexInfosOfType(type), info => createIndexInfo(info.keyType, getWidenedType(info.type), info.isReadonly, info.declaration, info.components)));
result.objectFlags |= getObjectFlags(type) & (ObjectFlags.JSLiteral | ObjectFlags.NonInferrableType); // Retain js literal flag through widening
return result;
}
@@ -32810,9 +32849,15 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
isTypeAssignableToKind(checkComputedPropertyName(firstDecl.name), TypeFlags.ESSymbol));
}
function isSymbolWithComputedName(symbol: Symbol) {
const firstDecl = symbol.declarations?.[0];
return firstDecl && isNamedDeclaration(firstDecl) && isComputedPropertyName(firstDecl.name);
}
// NOTE: currently does not make pattern literal indexers, eg `${number}px`
function getObjectLiteralIndexInfo(isReadonly: boolean, offset: number, properties: Symbol[], keyType: Type): IndexInfo {
const propTypes: Type[] = [];
let components: ElementWithComputedPropertyName[] | undefined;
for (let i = offset; i < properties.length; i++) {
const prop = properties[i];
if (
@@ -32821,10 +32866,13 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
keyType === esSymbolType && isSymbolWithSymbolName(prop)
) {
propTypes.push(getTypeOfSymbol(properties[i]));
if (isSymbolWithComputedName(properties[i])) {
components = append(components, properties[i].declarations?.[0]! as ElementWithComputedPropertyName);
}
}
}
const unionType = propTypes.length ? getUnionType(propTypes, UnionReduction.Subtype) : undefinedType;
return createIndexInfo(keyType, unionType, isReadonly);
return createIndexInfo(keyType, unionType, isReadonly, /*declaration*/ undefined, components);
}
function getImmediateAliasedSymbol(symbol: Symbol): Symbol | undefined {
@@ -46239,9 +46287,13 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
const typeDeclaration = symbol.valueDeclaration;
if (typeDeclaration && isClassLike(typeDeclaration)) {
for (const member of typeDeclaration.members) {
// Only process instance properties with computed names here. Static properties cannot be in conflict with indexers,
// and properties with literal names were already checked.
if (!isStatic(member) && !hasBindableName(member)) {
// Only process instance properties against instance index signatures and static properties against static index signatures
if (
(
(!isStaticIndex && !isStatic(member)) ||
(isStaticIndex && isStatic(member))
) && !hasBindableName(member)
) {
const symbol = getSymbolOfDeclaration(member);
checkIndexConstraintForProperty(type, symbol, getTypeOfExpression((member as DynamicNamedDeclaration).name.expression), getNonMissingTypeOfSymbol(symbol));
}
@@ -50848,6 +50900,29 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
for (const info of infoList!) {
if (info.declaration) continue;
if (info === anyBaseTypeIndexInfo) continue; // inherited, but looks like a late-bound signature because it has no declarations
if (info.components) {
const allComponentComputedNamesSerializable = every(info.components, e => {
return !!(e.name && isComputedPropertyName(e.name) && isEntityNameExpression(e.name.expression) && enclosing && isEntityNameVisible(e.name.expression, enclosing, /*shouldComputeAliasToMakeVisible*/ false)?.accessibility === SymbolAccessibility.Accessible);
});
if (allComponentComputedNamesSerializable) {
const newComponents = filter(info.components, e => {
// skip late bound props that contribute to the index signature - they'll be preserved via other means
return !hasLateBindableName(e);
});
result.push(...map(newComponents, e => {
trackComputedName(e.name.expression as EntityNameExpression);
const mods = infoList === staticInfos ? [factory.createModifier(SyntaxKind.StaticKeyword)] as Modifier[] : undefined;
return factory.createPropertyDeclaration(
append(mods, info.isReadonly ? factory.createModifier(SyntaxKind.ReadonlyKeyword) : undefined),
e.name,
(isPropertySignature(e) || isPropertyDeclaration(e) || isMethodSignature(e) || isMethodDeclaration(e) || isGetAccessor(e) || isSetAccessor(e)) && e.questionToken ? factory.createToken(SyntaxKind.QuestionToken) : undefined,
nodeBuilder.typeToTypeNode(getTypeOfSymbol(e.symbol), enclosing, flags, internalFlags, tracker),
/*initializer*/ undefined,
);
}));
continue;
}
}
const node = nodeBuilder.indexInfoToIndexSignatureDeclaration(info, enclosing, flags, internalFlags, tracker);
if (node && infoList === staticInfos) {
(((node as Mutable<typeof node>).modifiers ||= factory.createNodeArray()) as MutableNodeArray<Modifier>).unshift(factory.createModifier(SyntaxKind.StaticKeyword));
@@ -50858,6 +50933,16 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
}
}
return result;
function trackComputedName(accessExpression: EntityNameOrEntityNameExpression) {
if (!tracker.trackSymbol) return;
// get symbol of the first identifier of the entityName
const firstIdentifier = getFirstIdentifier(accessExpression);
const name = resolveName(firstIdentifier, firstIdentifier.escapedText, SymbolFlags.Value | SymbolFlags.ExportValue, /*nameNotFoundMessage*/ undefined, /*isUse*/ true);
if (name) {
tracker.trackSymbol(name, enclosing, SymbolFlags.Value);
}
}
},
};
@@ -52311,7 +52396,8 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
}
function checkGrammarForInvalidDynamicName(node: DeclarationName, message: DiagnosticMessage) {
if (isNonBindableDynamicName(node)) {
// Even non-bindable names are allowed as late-bound implied index signatures so long as the name is a simple `a.b.c` type name expression
if (isNonBindableDynamicName(node) && !isEntityNameExpression(isElementAccessExpression(node) ? skipParentheses(node.argumentExpression) : (node as ComputedPropertyName).expression)) {
return grammarErrorOnNode(node, message);
}
}
+4 -1
View File
@@ -5886,7 +5886,7 @@ export interface EmitResolver {
getDeclarationStatementsForSourceFile(node: SourceFile, flags: NodeBuilderFlags, internalFlags: InternalNodeBuilderFlags, tracker: SymbolTracker): Statement[] | undefined;
isImportRequiredByAugmentation(decl: ImportDeclaration): boolean;
isDefinitelyReferenceToGlobalSymbolObject(node: Node): boolean;
createLateBoundIndexSignatures(cls: ClassLikeDeclaration, enclosingDeclaration: Node, flags: NodeBuilderFlags, internalFlags: InternalNodeBuilderFlags, tracker: SymbolTracker): IndexSignatureDeclaration[] | undefined;
createLateBoundIndexSignatures(cls: ClassLikeDeclaration, enclosingDeclaration: Node, flags: NodeBuilderFlags, internalFlags: InternalNodeBuilderFlags, tracker: SymbolTracker): (IndexSignatureDeclaration | PropertyDeclaration)[] | undefined;
}
// dprint-ignore
@@ -7020,11 +7020,14 @@ export const enum IndexKind {
Number,
}
export type ElementWithComputedPropertyName = (ClassElement | ObjectLiteralElement) & { name: ComputedPropertyName; };
export interface IndexInfo {
keyType: Type;
type: Type;
isReadonly: boolean;
declaration?: IndexSignatureDeclaration;
components?: ElementWithComputedPropertyName[];
}
/** @internal */
@@ -11,10 +11,10 @@ var Symbol: SymbolConstructor;
> : ^^^^^^^^^^^^^^^^^
var obj = {
>obj : { [x: string]: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^
>{ [Symbol.foo]: 0} : { [x: string]: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^
>obj : { [Symbol.foo]: number; }
> : ^^ ^^^^^^ ^^
>{ [Symbol.foo]: 0} : { [Symbol.foo]: number; }
> : ^^ ^^^^^^ ^^
[Symbol.foo]: 0
>[Symbol.foo] : number
@@ -32,8 +32,8 @@ var obj = {
obj[Symbol.foo];
>obj[Symbol.foo] : number
> : ^^^^^^
>obj : { [x: string]: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^
>obj : { [Symbol.foo]: number; }
> : ^^ ^^^^^^ ^^
>Symbol.foo : string
> : ^^^^^^
>Symbol : SymbolConstructor
+4
View File
@@ -6852,11 +6852,15 @@ declare namespace ts {
String = 0,
Number = 1,
}
type ElementWithComputedPropertyName = (ClassElement | ObjectLiteralElement) & {
name: ComputedPropertyName;
};
interface IndexInfo {
keyType: Type;
type: Type;
isReadonly: boolean;
declaration?: IndexSignatureDeclaration;
components?: ElementWithComputedPropertyName[];
}
enum InferencePriority {
None = 0,
@@ -177,12 +177,12 @@ function foo8(y = (async () => z)(), z = 1) {
// error - used as computed name of method
function foo9(y = {[z]() { return z; }}, z = 1) {
>foo9 : (y?: { [x: number]: () => number; }, z?: number) => void
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^
>y : { [x: number]: () => number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>{[z]() { return z; }} : { [x: number]: () => number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>foo9 : (y?: { [z]: () => number; }, z?: number) => void
> : ^ ^^^^^ ^^^^^^^^^^^^ ^^^^ ^^^^^^^^^^^^^^^^^^
>y : { [z]: () => number; }
> : ^^ ^^^^^^^^^^^^ ^^
>{[z]() { return z; }} : { [z]: () => number; }
> : ^^ ^^^^^^^^^^^^ ^^
>[z] : () => number
> : ^^^^^^^^^^^^
>z : number
@@ -1,11 +1,10 @@
capturedParametersInInitializers2.ts(3,20): error TS2373: Parameter 'y' cannot reference identifier 'x' declared after it.
capturedParametersInInitializers2.ts(4,14): error TS2373: Parameter 'y' cannot reference identifier 'x' declared after it.
capturedParametersInInitializers2.ts(6,10): error TS2373: Parameter 'y' cannot reference identifier 'z' declared after it.
capturedParametersInInitializers2.ts(13,26): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
capturedParametersInInitializers2.ts(13,27): error TS2373: Parameter 'y' cannot reference identifier 'x' declared after it.
==== capturedParametersInInitializers2.ts (5 errors) ====
==== capturedParametersInInitializers2.ts (4 errors) ====
function foo(
y = class {
static c = x;
@@ -25,8 +24,6 @@ capturedParametersInInitializers2.ts(13,27): error TS2373: Parameter 'y' cannot
y.c
}
function foo2(y = class {[x] = x}, x = 1) {
~~~
!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
~
!!! error TS2373: Parameter 'y' cannot reference identifier 'x' declared after it.
}
@@ -24,10 +24,10 @@ let s = `${n}`;
> : ^^^^^^
const numericIndex = { [n]: 1 };
>numericIndex : { [x: number]: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^
>{ [n]: 1 } : { [x: number]: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^
>numericIndex : { [n]: number; }
> : ^^ ^^^^^^ ^^
>{ [n]: 1 } : { [n]: number; }
> : ^^ ^^^^^^ ^^
>[n] : number
> : ^^^^^^
>n : number
@@ -42,18 +42,18 @@ numericIndex[n].toFixed();
> : ^ ^^^ ^^^^^
>numericIndex[n] : number
> : ^^^^^^
>numericIndex : { [x: number]: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^
>numericIndex : { [n]: number; }
> : ^^ ^^^^^^ ^^
>n : number
> : ^^^^^^
>toFixed : (fractionDigits?: number) => string
> : ^ ^^^ ^^^^^
const stringIndex = { [s]: 1 };
>stringIndex : { [x: string]: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^
>{ [s]: 1 } : { [x: string]: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^
>stringIndex : { [s]: number; }
> : ^^ ^^^^^^ ^^
>{ [s]: 1 } : { [s]: number; }
> : ^^ ^^^^^^ ^^
>[s] : number
> : ^^^^^^
>s : string
@@ -68,8 +68,8 @@ stringIndex[s].toFixed();
> : ^ ^^^ ^^^^^
>stringIndex[s] : number
> : ^^^^^^
>stringIndex : { [x: string]: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^
>stringIndex : { [s]: number; }
> : ^^ ^^^^^^ ^^
>s : string
> : ^^^^^^
>toFixed : (fractionDigits?: number) => string
@@ -27,13 +27,15 @@ 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 (): {
[x: symbol]: () => number;
[a]: () => number;
};
} & (new (...args: any[]) => {
mixed: true;
});
export {};
@@ -8,8 +8,8 @@ function f (m: string) {
> : ^^^^^^
[1, 2, 3].map(i => {
>[1, 2, 3].map(i => { return true? { [m]: i } : { [m]: i + 1 } }) : { [x: string]: number; }[]
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^
>[1, 2, 3].map(i => { return true? { [m]: i } : { [m]: i + 1 } }) : { [m]: number; }[]
> : ^^ ^^^^^^ ^^^^
>[1, 2, 3].map : <U>(callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[]
> : ^ ^^ ^^^ ^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^
>[1, 2, 3] : number[]
@@ -22,26 +22,26 @@ function f (m: string) {
> : ^
>map : <U>(callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[]
> : ^ ^^ ^^^ ^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^
>i => { return true? { [m]: i } : { [m]: i + 1 } } : (i: number) => { [x: string]: number; }
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>i => { return true? { [m]: i } : { [m]: i + 1 } } : (i: number) => { [m]: number; }
> : ^ ^^^^^^^^^^^^^^^ ^^^^^^ ^^
>i : number
> : ^^^^^^
return true? { [m]: i } : { [m]: i + 1 }
>true? { [m]: i } : { [m]: i + 1 } : { [x: string]: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^
>true? { [m]: i } : { [m]: i + 1 } : { [m]: number; }
> : ^^ ^^^^^^ ^^
>true : true
> : ^^^^
>{ [m]: i } : { [x: string]: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^
>{ [m]: i } : { [m]: number; }
> : ^^ ^^^^^^ ^^
>[m] : number
> : ^^^^^^
>m : string
> : ^^^^^^
>i : number
> : ^^^^^^
>{ [m]: i + 1 } : { [x: string]: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^
>{ [m]: i + 1 } : { [m]: number; }
> : ^^ ^^^^^^ ^^
>[m] : number
> : ^^^^^^
>m : string
@@ -1,10 +1,9 @@
complicatedPrivacy.ts(11,24): error TS1054: A 'get' accessor cannot have parameters.
complicatedPrivacy.ts(35,5): error TS1170: A computed property name in a type literal must refer to an expression whose type is a literal type or a 'unique symbol' type.
complicatedPrivacy.ts(35,6): error TS2693: 'number' only refers to a type, but is being used as a value here.
complicatedPrivacy.ts(73,55): error TS2694: Namespace 'mglo5' has no exported member 'i6'.
==== complicatedPrivacy.ts (4 errors) ====
==== complicatedPrivacy.ts (3 errors) ====
module m1 {
export module m2 {
@@ -42,8 +41,6 @@ complicatedPrivacy.ts(73,55): error TS2694: Namespace 'mglo5' has no exported me
export function f4(arg1:
{
[number]: C1; // Used to be indexer, now it is a computed property
~~~~~~~~
!!! error TS1170: A computed property name in a type literal must refer to an expression whose type is a literal type or a 'unique symbol' type.
~~~~~~
!!! error TS2693: 'number' only refers to a type, but is being used as a value here.
}) {
@@ -181,8 +181,8 @@ let [{[foo.toExponential()]: bar7}] = [{bar: "bar"}];
> : ^^^^^^^^^^^^^^^^
>{[foo]: bar} = {bar: "bar"} : { bar: string; }
> : ^^^^^^^^^^^^^^^^
>{[foo]: bar} : { [x: string]: any; }
> : ^^^^^^^^^^^^^^^^^^^^^
>{[foo]: bar} : { [foo]: any; }
> : ^^ ^^^ ^^
>[foo] : any
> : ^^^
>foo : string
@@ -241,10 +241,10 @@ let [{[foo.toExponential()]: bar7}] = [{bar: "bar"}];
[{[foo]: bar4}] = [{bar: "bar"}];
>[{[foo]: bar4}] = [{bar: "bar"}] : [{ bar: string; }]
> : ^^^^^^^^^^^^^^^^^^
>[{[foo]: bar4}] : [{ [x: string]: any; }]
> : ^^^^^^^^^^^^^^^^^^^^^^^
>{[foo]: bar4} : { [x: string]: any; }
> : ^^^^^^^^^^^^^^^^^^^^^
>[{[foo]: bar4}] : [{ [foo]: any; }]
> : ^^^ ^^^ ^^^
>{[foo]: bar4} : { [foo]: any; }
> : ^^ ^^^ ^^
>[foo] : any
> : ^^^
>foo : string
@@ -193,8 +193,8 @@ let [{[foo.toExponential()]: bar7}] = [{bar: "bar"}];
> : ^^^^^^^^^^^^^^^^
>{[foo]: bar} = {bar: "bar"} : { bar: string; }
> : ^^^^^^^^^^^^^^^^
>{[foo]: bar} : { [x: string]: any; }
> : ^^^^^^^^^^^^^^^^^^^^^
>{[foo]: bar} : { [foo]: any; }
> : ^^ ^^^ ^^
>[foo] : any
> : ^^^
>foo : string
@@ -253,10 +253,10 @@ let [{[foo.toExponential()]: bar7}] = [{bar: "bar"}];
[{[foo]: bar4}] = [{bar: "bar"}];
>[{[foo]: bar4}] = [{bar: "bar"}] : [{ bar: string; }]
> : ^^^^^^^^^^^^^^^^^^
>[{[foo]: bar4}] : [{ [x: string]: any; }]
> : ^^^^^^^^^^^^^^^^^^^^^^^
>{[foo]: bar4} : { [x: string]: any; }
> : ^^^^^^^^^^^^^^^^^^^^^
>[{[foo]: bar4}] : [{ [foo]: any; }]
> : ^^^ ^^^ ^^^
>{[foo]: bar4} : { [foo]: any; }
> : ^^ ^^^ ^^
>[foo] : any
> : ^^^
>foo : string
@@ -1,6 +1,7 @@
computedPropertiesNarrowed.ts(5,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
computedPropertiesNarrowed.ts(11,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
computedPropertiesNarrowed.ts(18,20): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
computedPropertiesNarrowed.ts(20,5): error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations.
computedPropertiesNarrowed.ts(22,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
computedPropertiesNarrowed.ts(26,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
computedPropertiesNarrowed.ts(31,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
@@ -9,7 +10,7 @@ computedPropertiesNarrowed.ts(42,5): error TS9038: Computed property names on cl
computedPropertiesNarrowed.ts(47,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
==== computedPropertiesNarrowed.ts (9 errors) ====
==== computedPropertiesNarrowed.ts (10 errors) ====
const x: 0 | 1 = Math.random()? 0: 1;
declare function assert(n: number): asserts n is 1;
assert(x);
@@ -39,6 +40,9 @@ computedPropertiesNarrowed.ts(47,5): error TS9038: Computed property names on cl
!!! related TS9027 computedPropertiesNarrowed.ts:18:12: Add a type annotation to the variable o32.
let u = Symbol();
~
!!! error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations.
!!! related TS9027 computedPropertiesNarrowed.ts:20:5: Add a type annotation to the variable u.
export let o4 = {
[u]: 1 // Should error, nut a unique symbol
~~~
@@ -122,10 +122,10 @@ let u = Symbol();
> : ^^^^^^^^^^^^^^^^^
export let o4 = {
>o4 : { [x: symbol]: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^
>{ [u]: 1 // Should error, nut a unique symbol} : { [x: symbol]: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^
>o4 : { [u]: number; }
> : ^^ ^^^^^^ ^^
>{ [u]: 1 // Should error, nut a unique symbol} : { [u]: number; }
> : ^^ ^^^^^^ ^^
[u]: 1 // Should error, nut a unique symbol
>[u] : number
@@ -1,26 +1,19 @@
computedPropertyNames12_ES5.ts(5,5): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
computedPropertyNames12_ES5.ts(6,5): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
computedPropertyNames12_ES5.ts(7,12): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
computedPropertyNames12_ES5.ts(8,5): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
computedPropertyNames12_ES5.ts(9,5): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
computedPropertyNames12_ES5.ts(9,5): error TS2411: Property '[+s]' of type 'string' is not assignable to 'number' index type 'number'.
computedPropertyNames12_ES5.ts(9,5): error TS2411: Property '[+s]' of type 'string' is not assignable to 'string' index type 'number'.
computedPropertyNames12_ES5.ts(12,5): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
computedPropertyNames12_ES5.ts(13,12): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
computedPropertyNames12_ES5.ts(15,12): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
==== computedPropertyNames12_ES5.ts (10 errors) ====
==== computedPropertyNames12_ES5.ts (7 errors) ====
var s: string;
var n: number;
var a: any;
class C {
[s]: number;
~~~
!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
[n] = n;
~~~
!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
static [s + s]: string;
~~~~~~~
!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
@@ -37,8 +30,6 @@ computedPropertyNames12_ES5.ts(15,12): error TS1166: A computed property name in
static [""]: number;
[0]: number;
[a]: number;
~~~
!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
static [<any>true]: number;
~~~~~~~~~~~
!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
@@ -1,26 +1,19 @@
computedPropertyNames12_ES6.ts(5,5): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
computedPropertyNames12_ES6.ts(6,5): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
computedPropertyNames12_ES6.ts(7,12): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
computedPropertyNames12_ES6.ts(8,5): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
computedPropertyNames12_ES6.ts(9,5): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
computedPropertyNames12_ES6.ts(9,5): error TS2411: Property '[+s]' of type 'string' is not assignable to 'number' index type 'number'.
computedPropertyNames12_ES6.ts(9,5): error TS2411: Property '[+s]' of type 'string' is not assignable to 'string' index type 'number'.
computedPropertyNames12_ES6.ts(12,5): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
computedPropertyNames12_ES6.ts(13,12): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
computedPropertyNames12_ES6.ts(15,12): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
==== computedPropertyNames12_ES6.ts (10 errors) ====
==== computedPropertyNames12_ES6.ts (7 errors) ====
var s: string;
var n: number;
var a: any;
class C {
[s]: number;
~~~
!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
[n] = n;
~~~
!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
static [s + s]: string;
~~~~~~~
!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
@@ -37,8 +30,6 @@ computedPropertyNames12_ES6.ts(15,12): error TS1166: A computed property name in
static [""]: number;
[0]: number;
[a]: number;
~~~
!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
static [<any>true]: number;
~~~~~~~~~~~
!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
@@ -24,8 +24,8 @@ extractIndexer({
> : ^^^^^^
>extractIndexer : <T>(p: { [n: number]: T; }) => T
> : ^ ^^ ^^ ^^^^^
>{ [a]: ""} : { [x: number]: string; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^
>{ [a]: ""} : { [a]: string; }
> : ^^ ^^^^^^ ^^
[a]: ""
>[a] : string
@@ -24,8 +24,8 @@ extractIndexer({
> : ^^^^^^
>extractIndexer : <T>(p: { [n: number]: T; }) => T
> : ^ ^^ ^^ ^^^^^
>{ [a]: ""} : { [x: number]: string; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^
>{ [a]: ""} : { [a]: string; }
> : ^^ ^^^^^^ ^^
[a]: ""
>[a] : string
@@ -14,10 +14,10 @@ var p3: string | boolean;
> : ^^^^^^^^^^^^^^^^
var v = {
>v : { [x: string]: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^
>{ [p1]: 0, [p2]: 1, [p3]: 2} : { [x: string]: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^
>v : { [p1]: number; [p2]: number; [p3]: number; }
> : ^^ ^^^^^^ ^ ^^^^^^ ^ ^^^^^^ ^^
>{ [p1]: 0, [p2]: 1, [p3]: 2} : { [p1]: number; [p2]: number; [p3]: number; }
> : ^^ ^^^^^^ ^ ^^^^^^ ^ ^^^^^^ ^^
[p1]: 0,
>[p1] : number
@@ -14,10 +14,10 @@ var p3: string | boolean;
> : ^^^^^^^^^^^^^^^^
var v = {
>v : { [x: string]: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^
>{ [p1]: 0, [p2]: 1, [p3]: 2} : { [x: string]: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^
>v : { [p1]: number; [p2]: number; [p3]: number; }
> : ^^ ^^^^^^ ^ ^^^^^^ ^ ^^^^^^ ^^
>{ [p1]: 0, [p2]: 1, [p3]: 2} : { [p1]: number; [p2]: number; [p3]: number; }
> : ^^ ^^^^^^ ^ ^^^^^^ ^ ^^^^^^ ^^
[p1]: 0,
>[p1] : number
@@ -1,16 +0,0 @@
computedPropertyNamesOnOverloads_ES5.ts(4,5): error TS1168: A computed property name in a method overload must refer to an expression whose type is a literal type or a 'unique symbol' type.
computedPropertyNamesOnOverloads_ES5.ts(5,5): error TS1168: A computed property name in a method overload must refer to an expression whose type is a literal type or a 'unique symbol' type.
==== computedPropertyNamesOnOverloads_ES5.ts (2 errors) ====
var methodName = "method";
var accessorName = "accessor";
class C {
[methodName](v: string);
~~~~~~~~~~~~
!!! error TS1168: A computed property name in a method overload must refer to an expression whose type is a literal type or a 'unique symbol' type.
[methodName]();
~~~~~~~~~~~~
!!! error TS1168: A computed property name in a method overload must refer to an expression whose type is a literal type or a 'unique symbol' type.
[methodName](v?: string) { }
}
@@ -1,16 +0,0 @@
computedPropertyNamesOnOverloads_ES6.ts(4,5): error TS1168: A computed property name in a method overload must refer to an expression whose type is a literal type or a 'unique symbol' type.
computedPropertyNamesOnOverloads_ES6.ts(5,5): error TS1168: A computed property name in a method overload must refer to an expression whose type is a literal type or a 'unique symbol' type.
==== computedPropertyNamesOnOverloads_ES6.ts (2 errors) ====
var methodName = "method";
var accessorName = "accessor";
class C {
[methodName](v: string);
~~~~~~~~~~~~
!!! error TS1168: A computed property name in a method overload must refer to an expression whose type is a literal type or a 'unique symbol' type.
[methodName]();
~~~~~~~~~~~~
!!! error TS1168: A computed property name in a method overload must refer to an expression whose type is a literal type or a 'unique symbol' type.
[methodName](v?: string) { }
}
@@ -27,6 +27,7 @@ exports.C = C;
//// [main.d.ts]
import Test from "abcdefgh";
export declare class C {
[x: number]: () => void;
[Test.someKey]: () => void;
}
@@ -75,9 +75,9 @@ declare class Foo {
static p1: number;
p1: number;
}
export declare const t1: (typeof Foo)[typeof k1];
export declare const t1: () => number;
export declare const t2: () => string;
export declare const t3: typeof Foo.foo;
export declare const t3: () => number;
export declare const t4: () => string;
export declare const t5: typeof Foo.m1;
export declare const t6: () => void;
@@ -0,0 +1,37 @@
//// [tests/cases/compiler/declarationEmitComputedNameWithQuestionToken.ts] ////
//// [declarationEmitComputedNameWithQuestionToken.ts]
declare var something: string;
export const dataSomething = `data-${something}` as const;
export class WithData {
[dataSomething]?() {
return "something";
}
}
export const a = (new WithData())["ahahahaahah"]!();
//// [declarationEmitComputedNameWithQuestionToken.js]
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.a = exports.WithData = exports.dataSomething = void 0;
exports.dataSomething = "data-".concat(something);
var WithData = /** @class */ (function () {
function WithData() {
}
WithData.prototype[exports.dataSomething] = function () {
return "something";
};
return WithData;
}());
exports.WithData = WithData;
exports.a = (new WithData())["ahahahaahah"]();
//// [declarationEmitComputedNameWithQuestionToken.d.ts]
export declare const dataSomething: `data-${string}`;
export declare class WithData {
[dataSomething]?: () => string;
}
export declare const a: string;
@@ -0,0 +1,26 @@
//// [tests/cases/compiler/declarationEmitComputedNameWithQuestionToken.ts] ////
=== declarationEmitComputedNameWithQuestionToken.ts ===
declare var something: string;
>something : Symbol(something, Decl(declarationEmitComputedNameWithQuestionToken.ts, 0, 11))
export const dataSomething = `data-${something}` as const;
>dataSomething : Symbol(dataSomething, Decl(declarationEmitComputedNameWithQuestionToken.ts, 1, 12))
>something : Symbol(something, Decl(declarationEmitComputedNameWithQuestionToken.ts, 0, 11))
>const : Symbol(const)
export class WithData {
>WithData : Symbol(WithData, Decl(declarationEmitComputedNameWithQuestionToken.ts, 1, 58))
[dataSomething]?() {
>[dataSomething] : Symbol(WithData[dataSomething], Decl(declarationEmitComputedNameWithQuestionToken.ts, 3, 23))
>dataSomething : Symbol(dataSomething, Decl(declarationEmitComputedNameWithQuestionToken.ts, 1, 12))
return "something";
}
}
export const a = (new WithData())["ahahahaahah"]!();
>a : Symbol(a, Decl(declarationEmitComputedNameWithQuestionToken.ts, 9, 12))
>WithData : Symbol(WithData, Decl(declarationEmitComputedNameWithQuestionToken.ts, 1, 58))
@@ -0,0 +1,51 @@
//// [tests/cases/compiler/declarationEmitComputedNameWithQuestionToken.ts] ////
=== declarationEmitComputedNameWithQuestionToken.ts ===
declare var something: string;
>something : string
> : ^^^^^^
export const dataSomething = `data-${something}` as const;
>dataSomething : `data-${string}`
> : ^^^^^^^^^^^^^^^^
>`data-${something}` as const : `data-${string}`
> : ^^^^^^^^^^^^^^^^
>`data-${something}` : `data-${string}`
> : ^^^^^^^^^^^^^^^^
>something : string
> : ^^^^^^
export class WithData {
>WithData : WithData
> : ^^^^^^^^
[dataSomething]?() {
>[dataSomething] : () => string
> : ^^^^^^^^^^^^
>dataSomething : `data-${string}`
> : ^^^^^^^^^^^^^^^^
return "something";
>"something" : "something"
> : ^^^^^^^^^^^
}
}
export const a = (new WithData())["ahahahaahah"]!();
>a : string
> : ^^^^^^
>(new WithData())["ahahahaahah"]!() : string
> : ^^^^^^
>(new WithData())["ahahahaahah"]! : () => string
> : ^^^^^^^^^^^^
>(new WithData())["ahahahaahah"] : () => string
> : ^^^^^^^^^^^^
>(new WithData()) : WithData
> : ^^^^^^^^
>new WithData() : WithData
> : ^^^^^^^^
>WithData : typeof WithData
> : ^^^^^^^^^^^^^^^
>"ahahahaahah" : "ahahahaahah"
> : ^^^^^^^^^^^^^
@@ -0,0 +1,64 @@
//// [tests/cases/compiler/declarationEmitComputedNamesInaccessible.ts] ////
//// [declarationEmitComputedNamesInaccessible.ts]
export function f1() {
const localClassFieldName = Math.random() > 0.5 ? "g1" : "g2";
const localOtherField = localClassFieldName === "g1" ? "g2" : "g1";
const localStaticField = Math.random() > 0.5 ? "s1" : "s2";
return class ParameterizedHolder {
[localClassFieldName]() {
return "value";
}
[localOtherField]() {
return 42;
}
static [localStaticField]() {
return { static: true };
}
static [localStaticField]() {
return { static: "sometimes" };
}
}
}
//// [declarationEmitComputedNamesInaccessible.js]
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.f1 = f1;
function f1() {
var localClassFieldName = Math.random() > 0.5 ? "g1" : "g2";
var localOtherField = localClassFieldName === "g1" ? "g2" : "g1";
var localStaticField = Math.random() > 0.5 ? "s1" : "s2";
return /** @class */ (function () {
function ParameterizedHolder() {
}
ParameterizedHolder.prototype[localClassFieldName] = function () {
return "value";
};
ParameterizedHolder.prototype[localOtherField] = function () {
return 42;
};
ParameterizedHolder[localStaticField] = function () {
return { static: true };
};
ParameterizedHolder[localStaticField] = function () {
return { static: "sometimes" };
};
return ParameterizedHolder;
}());
}
//// [declarationEmitComputedNamesInaccessible.d.ts]
export declare function f1(): {
new (): {
[x: string]: (() => string) | (() => number);
};
[x: string]: {
[x: string]: (() => string) | (() => number);
} | (() => {
static: boolean;
}) | (() => {
static: string;
});
};
@@ -0,0 +1,53 @@
//// [tests/cases/compiler/declarationEmitComputedNamesInaccessible.ts] ////
=== declarationEmitComputedNamesInaccessible.ts ===
export function f1() {
>f1 : Symbol(f1, Decl(declarationEmitComputedNamesInaccessible.ts, 0, 0))
const localClassFieldName = Math.random() > 0.5 ? "g1" : "g2";
>localClassFieldName : Symbol(localClassFieldName, Decl(declarationEmitComputedNamesInaccessible.ts, 1, 9))
>Math.random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --))
>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --))
const localOtherField = localClassFieldName === "g1" ? "g2" : "g1";
>localOtherField : Symbol(localOtherField, Decl(declarationEmitComputedNamesInaccessible.ts, 2, 9))
>localClassFieldName : Symbol(localClassFieldName, Decl(declarationEmitComputedNamesInaccessible.ts, 1, 9))
const localStaticField = Math.random() > 0.5 ? "s1" : "s2";
>localStaticField : Symbol(localStaticField, Decl(declarationEmitComputedNamesInaccessible.ts, 3, 9))
>Math.random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --))
>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --))
return class ParameterizedHolder {
>ParameterizedHolder : Symbol(ParameterizedHolder, Decl(declarationEmitComputedNamesInaccessible.ts, 4, 10))
[localClassFieldName]() {
>[localClassFieldName] : Symbol(ParameterizedHolder[localClassFieldName], Decl(declarationEmitComputedNamesInaccessible.ts, 4, 38))
>localClassFieldName : Symbol(localClassFieldName, Decl(declarationEmitComputedNamesInaccessible.ts, 1, 9))
return "value";
}
[localOtherField]() {
>[localOtherField] : Symbol(ParameterizedHolder[localOtherField], Decl(declarationEmitComputedNamesInaccessible.ts, 7, 9))
>localOtherField : Symbol(localOtherField, Decl(declarationEmitComputedNamesInaccessible.ts, 2, 9))
return 42;
}
static [localStaticField]() {
>[localStaticField] : Symbol(ParameterizedHolder[localStaticField], Decl(declarationEmitComputedNamesInaccessible.ts, 10, 9))
>localStaticField : Symbol(localStaticField, Decl(declarationEmitComputedNamesInaccessible.ts, 3, 9))
return { static: true };
>static : Symbol(static, Decl(declarationEmitComputedNamesInaccessible.ts, 12, 20))
}
static [localStaticField]() {
>[localStaticField] : Symbol(ParameterizedHolder[localStaticField], Decl(declarationEmitComputedNamesInaccessible.ts, 13, 9))
>localStaticField : Symbol(localStaticField, Decl(declarationEmitComputedNamesInaccessible.ts, 3, 9))
return { static: "sometimes" };
>static : Symbol(static, Decl(declarationEmitComputedNamesInaccessible.ts, 15, 20))
}
}
}
@@ -0,0 +1,123 @@
//// [tests/cases/compiler/declarationEmitComputedNamesInaccessible.ts] ////
=== declarationEmitComputedNamesInaccessible.ts ===
export function f1() {
>f1 : () => typeof ParameterizedHolder
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
const localClassFieldName = Math.random() > 0.5 ? "g1" : "g2";
>localClassFieldName : "g1" | "g2"
> : ^^^^^^^^^^^
>Math.random() > 0.5 ? "g1" : "g2" : "g1" | "g2"
> : ^^^^^^^^^^^
>Math.random() > 0.5 : boolean
> : ^^^^^^^
>Math.random() : number
> : ^^^^^^
>Math.random : () => number
> : ^^^^^^
>Math : Math
> : ^^^^
>random : () => number
> : ^^^^^^
>0.5 : 0.5
> : ^^^
>"g1" : "g1"
> : ^^^^
>"g2" : "g2"
> : ^^^^
const localOtherField = localClassFieldName === "g1" ? "g2" : "g1";
>localOtherField : "g1" | "g2"
> : ^^^^^^^^^^^
>localClassFieldName === "g1" ? "g2" : "g1" : "g1" | "g2"
> : ^^^^^^^^^^^
>localClassFieldName === "g1" : boolean
> : ^^^^^^^
>localClassFieldName : "g1" | "g2"
> : ^^^^^^^^^^^
>"g1" : "g1"
> : ^^^^
>"g2" : "g2"
> : ^^^^
>"g1" : "g1"
> : ^^^^
const localStaticField = Math.random() > 0.5 ? "s1" : "s2";
>localStaticField : "s1" | "s2"
> : ^^^^^^^^^^^
>Math.random() > 0.5 ? "s1" : "s2" : "s1" | "s2"
> : ^^^^^^^^^^^
>Math.random() > 0.5 : boolean
> : ^^^^^^^
>Math.random() : number
> : ^^^^^^
>Math.random : () => number
> : ^^^^^^
>Math : Math
> : ^^^^
>random : () => number
> : ^^^^^^
>0.5 : 0.5
> : ^^^
>"s1" : "s1"
> : ^^^^
>"s2" : "s2"
> : ^^^^
return class ParameterizedHolder {
>class ParameterizedHolder { [localClassFieldName]() { return "value"; } [localOtherField]() { return 42; } static [localStaticField]() { return { static: true }; } static [localStaticField]() { return { static: "sometimes" }; } } : typeof ParameterizedHolder
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^
>ParameterizedHolder : typeof ParameterizedHolder
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^
[localClassFieldName]() {
>[localClassFieldName] : () => string
> : ^^^^^^^^^^^^
>localClassFieldName : "g1" | "g2"
> : ^^^^^^^^^^^
return "value";
>"value" : "value"
> : ^^^^^^^
}
[localOtherField]() {
>[localOtherField] : () => number
> : ^^^^^^^^^^^^
>localOtherField : "g1" | "g2"
> : ^^^^^^^^^^^
return 42;
>42 : 42
> : ^^
}
static [localStaticField]() {
>[localStaticField] : () => { static: boolean; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^
>localStaticField : "s1" | "s2"
> : ^^^^^^^^^^^
return { static: true };
>{ static: true } : { static: boolean; }
> : ^^^^^^^^^^^^^^^^^^^^
>static : boolean
> : ^^^^^^^
>true : true
> : ^^^^
}
static [localStaticField]() {
>[localStaticField] : () => { static: string; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^
>localStaticField : "s1" | "s2"
> : ^^^^^^^^^^^
return { static: "sometimes" };
>{ static: "sometimes" } : { static: string; }
> : ^^^^^^^^^^^^^^^^^^^
>static : string
> : ^^^^^^
>"sometimes" : "sometimes"
> : ^^^^^^^^^^^
}
}
}
@@ -1,11 +1,8 @@
type.ts(1,28): error TS1170: A computed property name in a type literal must refer to an expression whose type is a literal type or a 'unique symbol' type.
type.ts(1,29): error TS2304: Cannot find name 'Enum'.
==== type.ts (2 errors) ====
==== type.ts (1 errors) ====
export type Type = { x?: { [Enum.A]: 0 } };
~~~~~~~~
!!! error TS1170: A computed property name in a type literal must refer to an expression whose type is a literal type or a 'unique symbol' type.
~~~~
!!! error TS2304: Cannot find name 'Enum'.
@@ -1,8 +1,7 @@
type.ts(7,28): error TS1170: A computed property name in a type literal must refer to an expression whose type is a literal type or a 'unique symbol' type.
type.ts(7,28): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
==== type.ts (2 errors) ====
==== type.ts (1 errors) ====
export namespace Foo {
export enum Enum {
A = "a",
@@ -11,8 +10,6 @@ type.ts(7,28): error TS2464: A computed property name must be of type 'string',
}
export type Type = { x?: { [Foo.Enum]: 0 } };
~~~~~~~~~~
!!! error TS1170: A computed property name in a type literal must refer to an expression whose type is a literal type or a 'unique symbol' type.
~~~~~~~~~~
!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
==== index.ts (0 errors) ====
@@ -0,0 +1,35 @@
//// [tests/cases/compiler/declarationEmitMultipleComputedNamesSameDomain.ts] ////
//// [declarationEmitMultipleComputedNamesSameDomain.ts]
declare const x: string;
declare const y: "y";
export class Test {
[x] = 10;
[y] = 10;
}
//// [declarationEmitMultipleComputedNamesSameDomain.js]
"use strict";
var _a, _b;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Test = void 0;
var Test = /** @class */ (function () {
function Test() {
this[_a] = 10;
this[_b] = 10;
}
return Test;
}());
exports.Test = Test;
_a = x, _b = y;
//// [declarationEmitMultipleComputedNamesSameDomain.d.ts]
declare const x: string;
declare const y: "y";
export declare class Test {
[x]: number;
[y]: number;
}
export {};
@@ -0,0 +1,20 @@
//// [tests/cases/compiler/declarationEmitMultipleComputedNamesSameDomain.ts] ////
=== declarationEmitMultipleComputedNamesSameDomain.ts ===
declare const x: string;
>x : Symbol(x, Decl(declarationEmitMultipleComputedNamesSameDomain.ts, 0, 13))
declare const y: "y";
>y : Symbol(y, Decl(declarationEmitMultipleComputedNamesSameDomain.ts, 1, 13))
export class Test {
>Test : Symbol(Test, Decl(declarationEmitMultipleComputedNamesSameDomain.ts, 1, 21))
[x] = 10;
>[x] : Symbol(Test[x], Decl(declarationEmitMultipleComputedNamesSameDomain.ts, 3, 19))
>x : Symbol(x, Decl(declarationEmitMultipleComputedNamesSameDomain.ts, 0, 13))
[y] = 10;
>[y] : Symbol(Test[y], Decl(declarationEmitMultipleComputedNamesSameDomain.ts, 4, 13))
>y : Symbol(y, Decl(declarationEmitMultipleComputedNamesSameDomain.ts, 1, 13))
}
@@ -0,0 +1,31 @@
//// [tests/cases/compiler/declarationEmitMultipleComputedNamesSameDomain.ts] ////
=== declarationEmitMultipleComputedNamesSameDomain.ts ===
declare const x: string;
>x : string
> : ^^^^^^
declare const y: "y";
>y : "y"
> : ^^^
export class Test {
>Test : Test
> : ^^^^
[x] = 10;
>[x] : number
> : ^^^^^^
>x : string
> : ^^^^^^
>10 : 10
> : ^^
[y] = 10;
>[y] : number
> : ^^^^^^
>y : "y"
> : ^^^
>10 : 10
> : ^^
}
@@ -0,0 +1,102 @@
//// [tests/cases/compiler/declarationEmitSimpleComputedNames1.ts] ////
//// [declarationEmitSimpleComputedNames1.ts]
export const fieldName = Math.random() > 0.5 ? "f1" : "f2";
export const conatainer = {
[fieldName]() {
return "result";
}
};
const classFieldName = Math.random() > 0.5 ? "g1" : "g2";
const otherField = classFieldName === "g1" ? "g2" : "g1";
const staticField = Math.random() > 0.5 ? "s1" : "s2";
export class Holder {
[classFieldName]() {
return "value";
}
[otherField]() {
return 42;
}
static [staticField]() {
return { static: true };
}
static [staticField]() {
return { static: "sometimes" };
}
}
/**
* Could be `"prototype"`, so all static string indexers include the instance type
*/
export const staticLookup = Holder["some" + "thing"];
export const instanceLookup = (new Holder())["some" + "thing"];
//// [declarationEmitSimpleComputedNames1.js]
"use strict";
var _a;
Object.defineProperty(exports, "__esModule", { value: true });
exports.instanceLookup = exports.staticLookup = exports.Holder = exports.conatainer = exports.fieldName = void 0;
exports.fieldName = Math.random() > 0.5 ? "f1" : "f2";
exports.conatainer = (_a = {},
_a[exports.fieldName] = function () {
return "result";
},
_a);
var classFieldName = Math.random() > 0.5 ? "g1" : "g2";
var otherField = classFieldName === "g1" ? "g2" : "g1";
var staticField = Math.random() > 0.5 ? "s1" : "s2";
var Holder = /** @class */ (function () {
function Holder() {
}
Holder.prototype[classFieldName] = function () {
return "value";
};
Holder.prototype[otherField] = function () {
return 42;
};
Holder[staticField] = function () {
return { static: true };
};
Holder[staticField] = function () {
return { static: "sometimes" };
};
return Holder;
}());
exports.Holder = Holder;
/**
* Could be `"prototype"`, so all static string indexers include the instance type
*/
exports.staticLookup = Holder["some" + "thing"];
exports.instanceLookup = (new Holder())["some" + "thing"];
//// [declarationEmitSimpleComputedNames1.d.ts]
export declare const fieldName: string;
export declare const conatainer: {
[fieldName]: () => string;
};
declare const classFieldName: string;
declare const otherField: string;
declare const staticField: string;
export declare class Holder {
static [staticField]: () => {
static: boolean;
};
static [staticField]: () => {
static: string;
};
[classFieldName]: () => string;
[otherField]: () => number;
}
/**
* Could be `"prototype"`, so all static string indexers include the instance type
*/
export declare const staticLookup: Holder | (() => {
static: boolean;
}) | (() => {
static: string;
});
export declare const instanceLookup: (() => string) | (() => number);
export {};
@@ -0,0 +1,78 @@
//// [tests/cases/compiler/declarationEmitSimpleComputedNames1.ts] ////
=== declarationEmitSimpleComputedNames1.ts ===
export const fieldName = Math.random() > 0.5 ? "f1" : "f2";
>fieldName : Symbol(fieldName, Decl(declarationEmitSimpleComputedNames1.ts, 0, 12))
>Math.random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --))
>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --))
export const conatainer = {
>conatainer : Symbol(conatainer, Decl(declarationEmitSimpleComputedNames1.ts, 1, 12))
[fieldName]() {
>[fieldName] : Symbol([fieldName], Decl(declarationEmitSimpleComputedNames1.ts, 1, 27))
>fieldName : Symbol(fieldName, Decl(declarationEmitSimpleComputedNames1.ts, 0, 12))
return "result";
}
};
const classFieldName = Math.random() > 0.5 ? "g1" : "g2";
>classFieldName : Symbol(classFieldName, Decl(declarationEmitSimpleComputedNames1.ts, 7, 5))
>Math.random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --))
>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --))
const otherField = classFieldName === "g1" ? "g2" : "g1";
>otherField : Symbol(otherField, Decl(declarationEmitSimpleComputedNames1.ts, 8, 5))
>classFieldName : Symbol(classFieldName, Decl(declarationEmitSimpleComputedNames1.ts, 7, 5))
const staticField = Math.random() > 0.5 ? "s1" : "s2";
>staticField : Symbol(staticField, Decl(declarationEmitSimpleComputedNames1.ts, 9, 5))
>Math.random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --))
>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --))
export class Holder {
>Holder : Symbol(Holder, Decl(declarationEmitSimpleComputedNames1.ts, 9, 54))
[classFieldName]() {
>[classFieldName] : Symbol(Holder[classFieldName], Decl(declarationEmitSimpleComputedNames1.ts, 10, 21))
>classFieldName : Symbol(classFieldName, Decl(declarationEmitSimpleComputedNames1.ts, 7, 5))
return "value";
}
[otherField]() {
>[otherField] : Symbol(Holder[otherField], Decl(declarationEmitSimpleComputedNames1.ts, 13, 5))
>otherField : Symbol(otherField, Decl(declarationEmitSimpleComputedNames1.ts, 8, 5))
return 42;
}
static [staticField]() {
>[staticField] : Symbol(Holder[staticField], Decl(declarationEmitSimpleComputedNames1.ts, 16, 5))
>staticField : Symbol(staticField, Decl(declarationEmitSimpleComputedNames1.ts, 9, 5))
return { static: true };
>static : Symbol(static, Decl(declarationEmitSimpleComputedNames1.ts, 18, 16))
}
static [staticField]() {
>[staticField] : Symbol(Holder[staticField], Decl(declarationEmitSimpleComputedNames1.ts, 19, 5))
>staticField : Symbol(staticField, Decl(declarationEmitSimpleComputedNames1.ts, 9, 5))
return { static: "sometimes" };
>static : Symbol(static, Decl(declarationEmitSimpleComputedNames1.ts, 21, 16))
}
}
/**
* Could be `"prototype"`, so all static string indexers include the instance type
*/
export const staticLookup = Holder["some" + "thing"];
>staticLookup : Symbol(staticLookup, Decl(declarationEmitSimpleComputedNames1.ts, 28, 12))
>Holder : Symbol(Holder, Decl(declarationEmitSimpleComputedNames1.ts, 9, 54))
export const instanceLookup = (new Holder())["some" + "thing"];
>instanceLookup : Symbol(instanceLookup, Decl(declarationEmitSimpleComputedNames1.ts, 29, 12))
>Holder : Symbol(Holder, Decl(declarationEmitSimpleComputedNames1.ts, 9, 54))
@@ -0,0 +1,192 @@
//// [tests/cases/compiler/declarationEmitSimpleComputedNames1.ts] ////
=== declarationEmitSimpleComputedNames1.ts ===
export const fieldName = Math.random() > 0.5 ? "f1" : "f2";
>fieldName : "f1" | "f2"
> : ^^^^^^^^^^^
>Math.random() > 0.5 ? "f1" : "f2" : "f1" | "f2"
> : ^^^^^^^^^^^
>Math.random() > 0.5 : boolean
> : ^^^^^^^
>Math.random() : number
> : ^^^^^^
>Math.random : () => number
> : ^^^^^^
>Math : Math
> : ^^^^
>random : () => number
> : ^^^^^^
>0.5 : 0.5
> : ^^^
>"f1" : "f1"
> : ^^^^
>"f2" : "f2"
> : ^^^^
export const conatainer = {
>conatainer : { [fieldName]: () => string; }
> : ^^ ^^^^^^^^^^^^ ^^
>{ [fieldName]() { return "result"; }} : { [fieldName]: () => string; }
> : ^^ ^^^^^^^^^^^^ ^^
[fieldName]() {
>[fieldName] : () => string
> : ^^^^^^^^^^^^
>fieldName : "f1" | "f2"
> : ^^^^^^^^^^^
return "result";
>"result" : "result"
> : ^^^^^^^^
}
};
const classFieldName = Math.random() > 0.5 ? "g1" : "g2";
>classFieldName : "g1" | "g2"
> : ^^^^^^^^^^^
>Math.random() > 0.5 ? "g1" : "g2" : "g1" | "g2"
> : ^^^^^^^^^^^
>Math.random() > 0.5 : boolean
> : ^^^^^^^
>Math.random() : number
> : ^^^^^^
>Math.random : () => number
> : ^^^^^^
>Math : Math
> : ^^^^
>random : () => number
> : ^^^^^^
>0.5 : 0.5
> : ^^^
>"g1" : "g1"
> : ^^^^
>"g2" : "g2"
> : ^^^^
const otherField = classFieldName === "g1" ? "g2" : "g1";
>otherField : "g1" | "g2"
> : ^^^^^^^^^^^
>classFieldName === "g1" ? "g2" : "g1" : "g1" | "g2"
> : ^^^^^^^^^^^
>classFieldName === "g1" : boolean
> : ^^^^^^^
>classFieldName : "g1" | "g2"
> : ^^^^^^^^^^^
>"g1" : "g1"
> : ^^^^
>"g2" : "g2"
> : ^^^^
>"g1" : "g1"
> : ^^^^
const staticField = Math.random() > 0.5 ? "s1" : "s2";
>staticField : "s1" | "s2"
> : ^^^^^^^^^^^
>Math.random() > 0.5 ? "s1" : "s2" : "s1" | "s2"
> : ^^^^^^^^^^^
>Math.random() > 0.5 : boolean
> : ^^^^^^^
>Math.random() : number
> : ^^^^^^
>Math.random : () => number
> : ^^^^^^
>Math : Math
> : ^^^^
>random : () => number
> : ^^^^^^
>0.5 : 0.5
> : ^^^
>"s1" : "s1"
> : ^^^^
>"s2" : "s2"
> : ^^^^
export class Holder {
>Holder : Holder
> : ^^^^^^
[classFieldName]() {
>[classFieldName] : () => string
> : ^^^^^^^^^^^^
>classFieldName : "g1" | "g2"
> : ^^^^^^^^^^^
return "value";
>"value" : "value"
> : ^^^^^^^
}
[otherField]() {
>[otherField] : () => number
> : ^^^^^^^^^^^^
>otherField : "g1" | "g2"
> : ^^^^^^^^^^^
return 42;
>42 : 42
> : ^^
}
static [staticField]() {
>[staticField] : () => { static: boolean; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^
>staticField : "s1" | "s2"
> : ^^^^^^^^^^^
return { static: true };
>{ static: true } : { static: boolean; }
> : ^^^^^^^^^^^^^^^^^^^^
>static : boolean
> : ^^^^^^^
>true : true
> : ^^^^
}
static [staticField]() {
>[staticField] : () => { static: string; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^
>staticField : "s1" | "s2"
> : ^^^^^^^^^^^
return { static: "sometimes" };
>{ static: "sometimes" } : { static: string; }
> : ^^^^^^^^^^^^^^^^^^^
>static : string
> : ^^^^^^
>"sometimes" : "sometimes"
> : ^^^^^^^^^^^
}
}
/**
* Could be `"prototype"`, so all static string indexers include the instance type
*/
export const staticLookup = Holder["some" + "thing"];
>staticLookup : Holder | (() => { static: boolean; }) | (() => { static: string; })
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>Holder["some" + "thing"] : Holder | (() => { static: boolean; }) | (() => { static: string; })
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>Holder : typeof Holder
> : ^^^^^^^^^^^^^
>"some" + "thing" : string
> : ^^^^^^
>"some" : "some"
> : ^^^^^^
>"thing" : "thing"
> : ^^^^^^^
export const instanceLookup = (new Holder())["some" + "thing"];
>instanceLookup : (() => string) | (() => number)
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>(new Holder())["some" + "thing"] : (() => string) | (() => number)
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>(new Holder()) : Holder
> : ^^^^^^
>new Holder() : Holder
> : ^^^^^^
>Holder : typeof Holder
> : ^^^^^^^^^^^^^
>"some" + "thing" : string
> : ^^^^^^
>"some" : "some"
> : ^^^^^^
>"thing" : "thing"
> : ^^^^^^^
@@ -1,9 +1,6 @@
decoratorsOnComputedProperties.ts(18,5): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
decoratorsOnComputedProperties.ts(19,8): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
decoratorsOnComputedProperties.ts(20,8): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
decoratorsOnComputedProperties.ts(21,5): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
decoratorsOnComputedProperties.ts(22,8): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
decoratorsOnComputedProperties.ts(23,8): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
decoratorsOnComputedProperties.ts(27,5): error TS1206: Decorators are not valid here.
decoratorsOnComputedProperties.ts(28,5): error TS1206: Decorators are not valid here.
decoratorsOnComputedProperties.ts(29,5): error TS1206: Decorators are not valid here.
@@ -11,15 +8,11 @@ decoratorsOnComputedProperties.ts(30,5): error TS1206: Decorators are not valid
decoratorsOnComputedProperties.ts(35,5): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
decoratorsOnComputedProperties.ts(36,5): error TS1206: Decorators are not valid here.
decoratorsOnComputedProperties.ts(37,5): error TS1206: Decorators are not valid here.
decoratorsOnComputedProperties.ts(38,5): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
decoratorsOnComputedProperties.ts(39,5): error TS1206: Decorators are not valid here.
decoratorsOnComputedProperties.ts(40,5): error TS1206: Decorators are not valid here.
decoratorsOnComputedProperties.ts(52,5): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
decoratorsOnComputedProperties.ts(53,8): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
decoratorsOnComputedProperties.ts(54,8): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
decoratorsOnComputedProperties.ts(55,5): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
decoratorsOnComputedProperties.ts(56,8): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
decoratorsOnComputedProperties.ts(57,8): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
decoratorsOnComputedProperties.ts(62,5): error TS1206: Decorators are not valid here.
decoratorsOnComputedProperties.ts(63,5): error TS1206: Decorators are not valid here.
decoratorsOnComputedProperties.ts(64,5): error TS1206: Decorators are not valid here.
@@ -27,15 +20,11 @@ decoratorsOnComputedProperties.ts(65,5): error TS1206: Decorators are not valid
decoratorsOnComputedProperties.ts(70,5): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
decoratorsOnComputedProperties.ts(71,5): error TS1206: Decorators are not valid here.
decoratorsOnComputedProperties.ts(72,5): error TS1206: Decorators are not valid here.
decoratorsOnComputedProperties.ts(73,5): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
decoratorsOnComputedProperties.ts(74,5): error TS1206: Decorators are not valid here.
decoratorsOnComputedProperties.ts(75,5): error TS1206: Decorators are not valid here.
decoratorsOnComputedProperties.ts(88,5): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
decoratorsOnComputedProperties.ts(89,8): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
decoratorsOnComputedProperties.ts(90,8): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
decoratorsOnComputedProperties.ts(92,5): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
decoratorsOnComputedProperties.ts(93,8): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
decoratorsOnComputedProperties.ts(94,8): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
decoratorsOnComputedProperties.ts(98,5): error TS1206: Decorators are not valid here.
decoratorsOnComputedProperties.ts(99,5): error TS1206: Decorators are not valid here.
decoratorsOnComputedProperties.ts(100,5): error TS1206: Decorators are not valid here.
@@ -43,15 +32,11 @@ decoratorsOnComputedProperties.ts(101,5): error TS1206: Decorators are not valid
decoratorsOnComputedProperties.ts(106,5): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
decoratorsOnComputedProperties.ts(107,5): error TS1206: Decorators are not valid here.
decoratorsOnComputedProperties.ts(108,5): error TS1206: Decorators are not valid here.
decoratorsOnComputedProperties.ts(110,5): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
decoratorsOnComputedProperties.ts(111,5): error TS1206: Decorators are not valid here.
decoratorsOnComputedProperties.ts(112,5): error TS1206: Decorators are not valid here.
decoratorsOnComputedProperties.ts(124,5): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
decoratorsOnComputedProperties.ts(125,8): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
decoratorsOnComputedProperties.ts(126,8): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
decoratorsOnComputedProperties.ts(128,5): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
decoratorsOnComputedProperties.ts(129,8): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
decoratorsOnComputedProperties.ts(131,8): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
decoratorsOnComputedProperties.ts(135,5): error TS1206: Decorators are not valid here.
decoratorsOnComputedProperties.ts(136,5): error TS1206: Decorators are not valid here.
decoratorsOnComputedProperties.ts(137,5): error TS1206: Decorators are not valid here.
@@ -59,15 +44,11 @@ decoratorsOnComputedProperties.ts(138,5): error TS1206: Decorators are not valid
decoratorsOnComputedProperties.ts(143,5): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
decoratorsOnComputedProperties.ts(144,5): error TS1206: Decorators are not valid here.
decoratorsOnComputedProperties.ts(145,5): error TS1206: Decorators are not valid here.
decoratorsOnComputedProperties.ts(147,5): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
decoratorsOnComputedProperties.ts(148,5): error TS1206: Decorators are not valid here.
decoratorsOnComputedProperties.ts(150,5): error TS1206: Decorators are not valid here.
decoratorsOnComputedProperties.ts(162,5): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
decoratorsOnComputedProperties.ts(163,8): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
decoratorsOnComputedProperties.ts(164,8): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
decoratorsOnComputedProperties.ts(166,5): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
decoratorsOnComputedProperties.ts(167,8): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
decoratorsOnComputedProperties.ts(169,8): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
decoratorsOnComputedProperties.ts(173,5): error TS1206: Decorators are not valid here.
decoratorsOnComputedProperties.ts(174,5): error TS1206: Decorators are not valid here.
decoratorsOnComputedProperties.ts(175,5): error TS1206: Decorators are not valid here.
@@ -76,12 +57,11 @@ decoratorsOnComputedProperties.ts(181,5): error TS1166: A computed property name
decoratorsOnComputedProperties.ts(182,5): error TS1206: Decorators are not valid here.
decoratorsOnComputedProperties.ts(183,5): error TS1206: Decorators are not valid here.
decoratorsOnComputedProperties.ts(184,5): error TS1206: Decorators are not valid here.
decoratorsOnComputedProperties.ts(185,5): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
decoratorsOnComputedProperties.ts(186,5): error TS1206: Decorators are not valid here.
decoratorsOnComputedProperties.ts(188,5): error TS1206: Decorators are not valid here.
==== decoratorsOnComputedProperties.ts (81 errors) ====
==== decoratorsOnComputedProperties.ts (61 errors) ====
function x(o: object, k: PropertyKey) { }
let i = 0;
function foo(): string { return ++i + ""; }
@@ -109,14 +89,8 @@ decoratorsOnComputedProperties.ts(188,5): error TS1206: Decorators are not valid
~~~~~~~
!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
[fieldNameA]: any;
~~~~~~~~~~~~
!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
@x [fieldNameB]: any;
~~~~~~~~~~~~
!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
@x [fieldNameC]: any = null;
~~~~~~~~~~~~
!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
}
void class B {
@@ -146,8 +120,6 @@ decoratorsOnComputedProperties.ts(188,5): error TS1206: Decorators are not valid
~
!!! error TS1206: Decorators are not valid here.
[fieldNameA]: any;
~~~~~~~~~~~~
!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
@x [fieldNameB]: any;
~
!!! error TS1206: Decorators are not valid here.
@@ -175,14 +147,8 @@ decoratorsOnComputedProperties.ts(188,5): error TS1206: Decorators are not valid
~~~~~~~
!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
[fieldNameA]: any;
~~~~~~~~~~~~
!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
@x [fieldNameB]: any;
~~~~~~~~~~~~
!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
@x [fieldNameC]: any = null;
~~~~~~~~~~~~
!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
["some" + "method"]() {}
}
@@ -213,8 +179,6 @@ decoratorsOnComputedProperties.ts(188,5): error TS1206: Decorators are not valid
~
!!! error TS1206: Decorators are not valid here.
[fieldNameA]: any;
~~~~~~~~~~~~
!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
@x [fieldNameB]: any;
~
!!! error TS1206: Decorators are not valid here.
@@ -244,14 +208,8 @@ decoratorsOnComputedProperties.ts(188,5): error TS1206: Decorators are not valid
!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
["some" + "method"]() {}
[fieldNameA]: any;
~~~~~~~~~~~~
!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
@x [fieldNameB]: any;
~~~~~~~~~~~~
!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
@x [fieldNameC]: any = null;
~~~~~~~~~~~~
!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
}
void class F {
@@ -282,8 +240,6 @@ decoratorsOnComputedProperties.ts(188,5): error TS1206: Decorators are not valid
!!! error TS1206: Decorators are not valid here.
["some" + "method"]() {}
[fieldNameA]: any;
~~~~~~~~~~~~
!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
@x [fieldNameB]: any;
~
!!! error TS1206: Decorators are not valid here.
@@ -312,15 +268,9 @@ decoratorsOnComputedProperties.ts(188,5): error TS1206: Decorators are not valid
!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
["some" + "method"]() {}
[fieldNameA]: any;
~~~~~~~~~~~~
!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
@x [fieldNameB]: any;
~~~~~~~~~~~~
!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
["some" + "method2"]() {}
@x [fieldNameC]: any = null;
~~~~~~~~~~~~
!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
}
void class H {
@@ -351,8 +301,6 @@ decoratorsOnComputedProperties.ts(188,5): error TS1206: Decorators are not valid
!!! error TS1206: Decorators are not valid here.
["some" + "method"]() {}
[fieldNameA]: any;
~~~~~~~~~~~~
!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
@x [fieldNameB]: any;
~
!!! error TS1206: Decorators are not valid here.
@@ -382,15 +330,9 @@ decoratorsOnComputedProperties.ts(188,5): error TS1206: Decorators are not valid
!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
@x ["some" + "method"]() {}
[fieldNameA]: any;
~~~~~~~~~~~~
!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
@x [fieldNameB]: any;
~~~~~~~~~~~~
!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
["some" + "method2"]() {}
@x [fieldNameC]: any = null;
~~~~~~~~~~~~
!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
}
void class J {
@@ -423,8 +365,6 @@ decoratorsOnComputedProperties.ts(188,5): error TS1206: Decorators are not valid
~
!!! error TS1206: Decorators are not valid here.
[fieldNameA]: any;
~~~~~~~~~~~~
!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
@x [fieldNameB]: any;
~
!!! error TS1206: Decorators are not valid here.
@@ -36,16 +36,16 @@ const { [K.a]: aVal, [K.b]: bVal } = (() => {
> : ^^^^^^
>bVal : number
> : ^^^^^^
>(() => { return { [K.a]: 1, [K.b]: 1 };})() : { [x: string]: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^
>(() => { return { [K.a]: 1, [K.b]: 1 };}) : () => { [x: string]: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>() => { return { [K.a]: 1, [K.b]: 1 };} : () => { [x: string]: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>(() => { return { [K.a]: 1, [K.b]: 1 };})() : { [K.a]: number; [K.b]: number; }
> : ^^ ^^^^^^ ^ ^^^^^^ ^^
>(() => { return { [K.a]: 1, [K.b]: 1 };}) : () => { [K.a]: number; [K.b]: number; }
> : ^^^^^^^^ ^^^^^^ ^ ^^^^^^ ^^
>() => { return { [K.a]: 1, [K.b]: 1 };} : () => { [K.a]: number; [K.b]: number; }
> : ^^^^^^^^ ^^^^^^ ^ ^^^^^^ ^^
return { [K.a]: 1, [K.b]: 1 };
>{ [K.a]: 1, [K.b]: 1 } : { [x: string]: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^
>{ [K.a]: 1, [K.b]: 1 } : { [K.a]: number; [K.b]: number; }
> : ^^ ^^^^^^ ^ ^^^^^^ ^^
>[K.a] : number
> : ^^^^^^
>K.a : string
@@ -36,16 +36,16 @@ const { [K.a]: aVal, [K.b]: bVal } = (() => {
> : ^^^^^^
>bVal : number
> : ^^^^^^
>(() => { return { [K.a]: 1, [K.b]: 1 };})() : { [x: string]: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^
>(() => { return { [K.a]: 1, [K.b]: 1 };}) : () => { [x: string]: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>() => { return { [K.a]: 1, [K.b]: 1 };} : () => { [x: string]: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>(() => { return { [K.a]: 1, [K.b]: 1 };})() : { [K.a]: number; [K.b]: number; }
> : ^^ ^^^^^^ ^ ^^^^^^ ^^
>(() => { return { [K.a]: 1, [K.b]: 1 };}) : () => { [K.a]: number; [K.b]: number; }
> : ^^^^^^^^ ^^^^^^ ^ ^^^^^^ ^^
>() => { return { [K.a]: 1, [K.b]: 1 };} : () => { [K.a]: number; [K.b]: number; }
> : ^^^^^^^^ ^^^^^^ ^ ^^^^^^ ^^
return { [K.a]: 1, [K.b]: 1 };
>{ [K.a]: 1, [K.b]: 1 } : { [x: string]: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^
>{ [K.a]: 1, [K.b]: 1 } : { [K.a]: number; [K.b]: number; }
> : ^^ ^^^^^^ ^ ^^^^^^ ^^
>[K.a] : number
> : ^^^^^^
>K.a : string
@@ -49,8 +49,8 @@ function bar(props: { x?: string; y?: string }) {
}
function foo({ x = "", y = "" }: { x?: string; y?: string }) {
>foo : ({ x, y }: { x?: string; y?: string; }) => { [x: string]: number; }
> : ^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>foo : ({ x, y }: { x?: string; y?: string; }) => { [x]: number; [y]: number; }
> : ^ ^^ ^^^^^^^ ^^^^^^ ^ ^^^^^^ ^^
>x : string
> : ^^^^^^
>"" : ""
@@ -65,8 +65,8 @@ function foo({ x = "", y = "" }: { x?: string; y?: string }) {
> : ^^^^^^^^^^^^^^^^^^
return {
>{ [x]: 1, [y]: 2, } : { [x: string]: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^
>{ [x]: 1, [y]: 2, } : { [x]: number; [y]: number; }
> : ^^ ^^^^^^ ^ ^^^^^^ ^^
[x]: 1,
>[x] : number
@@ -84,11 +84,11 @@ async function objectLiteral3() {
> : ^^^^^^^^^^^^^^^^^^^
x = {
>x = { [a]: await y, b: z } : { [x: number]: any; b: any; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>x = { [a]: await y, b: z } : { [a]: any; b: any; }
> : ^^ ^^^ ^^^^^^^^^^
>x : any
>{ [a]: await y, b: z } : { [x: number]: any; b: any; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>{ [a]: await y, b: z } : { [a]: any; b: any; }
> : ^^ ^^^ ^^^^^^^^^^
[a]: await y,
>[a] : any
@@ -108,11 +108,11 @@ async function objectLiteral4() {
> : ^^^^^^^^^^^^^^^^^^^
x = {
>x = { a: await y, [b]: z } : { [x: number]: any; a: any; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>x = { a: await y, [b]: z } : { [b]: any; a: any; }
> : ^^ ^^^ ^^^^^^^^^^
>x : any
>{ a: await y, [b]: z } : { [x: number]: any; a: any; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>{ a: await y, [b]: z } : { [b]: any; a: any; }
> : ^^ ^^^ ^^^^^^^^^^
a: await y,
>a : any
@@ -156,11 +156,11 @@ async function objectLiteral6() {
> : ^^^^^^^^^^^^^^^^^^^
x = {
>x = { a: y, [b]: await z } : { [x: number]: any; a: any; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>x = { a: y, [b]: await z } : { [b]: any; a: any; }
> : ^^ ^^^ ^^^^^^^^^^
>x : any
>{ a: y, [b]: await z } : { [x: number]: any; a: any; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>{ a: y, [b]: await z } : { [b]: any; a: any; }
> : ^^ ^^^ ^^^^^^^^^^
a: y,
>a : any
@@ -1,10 +1,9 @@
main.ts(8,5): error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'.
main.ts(8,5): error TS2343: This syntax requires an imported helper named '__propKey' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'.
main.ts(8,5): error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'.
main.ts(8,26): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
==== main.ts (4 errors) ====
==== main.ts (3 errors) ====
export {}
declare var dec: any;
@@ -19,8 +18,6 @@ main.ts(8,26): error TS1166: A computed property name in a class property declar
!!! error TS2343: This syntax requires an imported helper named '__propKey' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'.
~~~~
!!! error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'.
~~~
!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
}
==== tslib.d.ts (0 errors) ====
@@ -1,10 +1,9 @@
main.ts(8,5): error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'.
main.ts(8,5): error TS2343: This syntax requires an imported helper named '__propKey' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'.
main.ts(8,5): error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'.
main.ts(8,17): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
==== main.ts (4 errors) ====
==== main.ts (3 errors) ====
export {}
declare var dec: any;
@@ -19,8 +18,6 @@ main.ts(8,17): error TS1166: A computed property name in a class property declar
!!! error TS2343: This syntax requires an imported helper named '__propKey' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'.
~~~~
!!! error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'.
~~~
!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
}
==== tslib.d.ts (0 errors) ====
@@ -1,19 +1,16 @@
main.ts(6,11): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
main.ts(6,17): error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'.
main.ts(6,17): error TS2343: This syntax requires an imported helper named '__propKey' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'.
main.ts(6,17): error TS2343: This syntax requires an imported helper named '__runInitializers' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'.
main.ts(6,17): error TS2343: This syntax requires an imported helper named '__setFunctionName' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'.
==== main.ts (5 errors) ====
==== main.ts (4 errors) ====
export {};
declare var dec: any;
declare var x: any;
// uses __esDecorate, __runInitializers, __setFunctionName, __propKey
class C { [x] = @dec class {} }
~~~
!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
~~~~
!!! error TS2343: This syntax requires an imported helper named '__esDecorate' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'.
~~~~
@@ -1,17 +1,13 @@
indexSignatureMustHaveTypeAnnotation.ts(3,5): error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type.
indexSignatureMustHaveTypeAnnotation.ts(3,6): error TS2304: Cannot find name 'x'.
indexSignatureMustHaveTypeAnnotation.ts(4,5): error TS1021: An index signature must have a type annotation.
indexSignatureMustHaveTypeAnnotation.ts(9,5): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
indexSignatureMustHaveTypeAnnotation.ts(9,6): error TS2304: Cannot find name 'x'.
indexSignatureMustHaveTypeAnnotation.ts(14,5): error TS1021: An index signature must have a type annotation.
==== indexSignatureMustHaveTypeAnnotation.ts (6 errors) ====
==== indexSignatureMustHaveTypeAnnotation.ts (4 errors) ====
interface I {
// Used to be indexer, now it is a computed property
[x]: string;
~~~
!!! error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type.
~
!!! error TS2304: Cannot find name 'x'.
[x: string];
@@ -22,8 +18,6 @@ indexSignatureMustHaveTypeAnnotation.ts(14,5): error TS1021: An index signature
class C {
// Used to be indexer, now it is a computed property
[x]: string
~~~
!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
~
!!! error TS2304: Cannot find name 'x'.
@@ -1564,8 +1564,8 @@ type A = Record<IdType, string>;
const a: A = { [id]: 'test' }
>a : A
> : ^
>{ [id]: 'test' } : { [x: string]: string; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^
>{ [id]: 'test' } : { [id]: string; }
> : ^^ ^^^^^^ ^^
>[id] : string
> : ^^^^^^
>id : `${number}-${number}-${number}-${number}`
@@ -1,13 +1,10 @@
indexWithoutParamType2.ts(3,5): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
indexWithoutParamType2.ts(3,6): error TS2304: Cannot find name 'x'.
==== indexWithoutParamType2.ts (2 errors) ====
==== indexWithoutParamType2.ts (1 errors) ====
class C {
// Used to be indexer, now it is a computed property
[x]: string
~~~
!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
~
!!! error TS2304: Cannot find name 'x'.
}
@@ -7,21 +7,21 @@ isolatedDeclarationErrorsClasses.ts(11,9): error TS9009: At least one accessor m
isolatedDeclarationErrorsClasses.ts(12,9): error TS7032: Property 'setOnly' implicitly has type 'any', because its set accessor lacks a parameter type annotation.
isolatedDeclarationErrorsClasses.ts(12,17): error TS7006: Parameter 'value' implicitly has an 'any' type.
isolatedDeclarationErrorsClasses.ts(12,17): error TS9009: At least one accessor must have an explicit type annotation with --isolatedDeclarations.
isolatedDeclarationErrorsClasses.ts(36,5): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
isolatedDeclarationErrorsClasses.ts(36,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
isolatedDeclarationErrorsClasses.ts(36,6): error TS2304: Cannot find name 'missing'.
isolatedDeclarationErrorsClasses.ts(38,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
isolatedDeclarationErrorsClasses.ts(40,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
isolatedDeclarationErrorsClasses.ts(42,5): error TS9008: Method must have an explicit return type annotation with --isolatedDeclarations.
isolatedDeclarationErrorsClasses.ts(42,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
isolatedDeclarationErrorsClasses.ts(44,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
isolatedDeclarationErrorsClasses.ts(44,35): error TS7006: Parameter 'v' implicitly has an 'any' type.
isolatedDeclarationErrorsClasses.ts(44,35): error TS9011: Parameter must have an explicit type annotation with --isolatedDeclarations.
isolatedDeclarationErrorsClasses.ts(46,9): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
isolatedDeclarationErrorsClasses.ts(48,9): error TS7032: Property '[noParamAnnotationStringName]' implicitly has type 'any', because its set accessor lacks a parameter type annotation.
isolatedDeclarationErrorsClasses.ts(48,9): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
isolatedDeclarationErrorsClasses.ts(48,39): error TS7006: Parameter 'value' implicitly has an 'any' type.
isolatedDeclarationErrorsClasses.ts(50,5): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
isolatedDeclarationErrorsClasses.ts(50,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
isolatedDeclarationErrorsClasses.ts(55,5): error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type.
isolatedDeclarationErrorsClasses.ts(56,5): error TS7010: '[noAnnotationLiteralName]', which lacks return-type annotation, implicitly has an 'any' return type.
isolatedDeclarationErrorsClasses.ts(56,5): error TS9013: Expression type can't be inferred with --isolatedDeclarations.
@@ -88,8 +88,6 @@ isolatedDeclarationErrorsClasses.ts(56,5): error TS9013: Expression type can't b
// Should not be reported as an isolated declaration error
[missing] = 1;
~~~~~~~~~
!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
~~~~~~~~~
!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
~~~~~~~
!!! error TS2304: Cannot find name 'missing'.
@@ -104,6 +102,9 @@ isolatedDeclarationErrorsClasses.ts(56,5): error TS9013: Expression type can't b
[noAnnotationStringName]() { }
~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS9008: Method must have an explicit return type annotation with --isolatedDeclarations.
!!! related TS9034 isolatedDeclarationErrorsClasses.ts:42:5: Add a return type to the method
~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
[noParamAnnotationStringName](v): void { }
@@ -111,6 +112,9 @@ isolatedDeclarationErrorsClasses.ts(56,5): error TS9013: Expression type can't b
!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
~
!!! error TS7006: Parameter 'v' implicitly has an 'any' type.
~
!!! error TS9011: Parameter must have an explicit type annotation with --isolatedDeclarations.
!!! related TS9028 isolatedDeclarationErrorsClasses.ts:44:35: Add a type annotation to the parameter v.
get [noAnnotationStringName]() { return 0;}
~~~~~~~~~~~~~~~~~~~~~~~~
@@ -134,8 +138,6 @@ isolatedDeclarationErrorsClasses.ts(56,5): error TS9013: Expression type can't b
export interface I {
[noAnnotationStringName]: 10;
~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type.
[noAnnotationLiteralName]();
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS7010: '[noAnnotationLiteralName]', which lacks return-type annotation, implicitly has an 'any' return type.
@@ -1,15 +1,11 @@
overloadsWithComputedNames.ts(4,5): error TS2389: Function implementation name must be '["B"]'.
overloadsWithComputedNames.ts(14,5): error TS2391: Function implementation is missing or not immediately following the declaration.
overloadsWithComputedNames.ts(16,5): error TS2389: Function implementation name must be '["bar"]'.
overloadsWithComputedNames.ts(28,5): error TS1168: A computed property name in a method overload must refer to an expression whose type is a literal type or a 'unique symbol' type.
overloadsWithComputedNames.ts(29,5): error TS2391: Function implementation is missing or not immediately following the declaration.
overloadsWithComputedNames.ts(35,5): error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type.
overloadsWithComputedNames.ts(42,5): error TS1168: A computed property name in a method overload must refer to an expression whose type is a literal type or a 'unique symbol' type.
overloadsWithComputedNames.ts(47,5): error TS1168: A computed property name in a method overload must refer to an expression whose type is a literal type or a 'unique symbol' type.
overloadsWithComputedNames.ts(52,5): error TS2391: Function implementation is missing or not immediately following the declaration.
==== overloadsWithComputedNames.ts (9 errors) ====
==== overloadsWithComputedNames.ts (5 errors) ====
// https://github.com/microsoft/TypeScript/issues/52329
class Person {
["B"](a: number): string;
@@ -44,8 +40,6 @@ overloadsWithComputedNames.ts(52,5): error TS2391: Function implementation is mi
class C1 {
[sym](): void; // should error
~~~~~
!!! error TS1168: A computed property name in a method overload must refer to an expression whose type is a literal type or a 'unique symbol' type.
[uniqueSym2](): void; // should error
~~~~~~~~~~~~
!!! error TS2391: Function implementation is missing or not immediately following the declaration.
@@ -55,8 +49,6 @@ overloadsWithComputedNames.ts(52,5): error TS2391: Function implementation is mi
interface I1 {
[sym](): void; // should error
~~~~~
!!! error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type.
[uniqueSym2](): void;
[uniqueSym](): void;
[uniqueSym](): void;
@@ -64,15 +56,11 @@ overloadsWithComputedNames.ts(52,5): error TS2391: Function implementation is mi
class C2 {
[strUnion](): void; // should error
~~~~~~~~~~
!!! error TS1168: A computed property name in a method overload must refer to an expression whose type is a literal type or a 'unique symbol' type.
[strUnion]() { }
}
class I2 {
[strUnion](): void; // should error
~~~~~~~~~~
!!! error TS1168: A computed property name in a method overload must refer to an expression whose type is a literal type or a 'unique symbol' type.
[strUnion]() { }
}
@@ -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;
}
@@ -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;
}
@@ -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;
}
@@ -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;
}
@@ -1,12 +1,9 @@
parserComputedPropertyName10.ts(2,4): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
parserComputedPropertyName10.ts(2,5): error TS2304: Cannot find name 'e'.
==== parserComputedPropertyName10.ts (2 errors) ====
==== parserComputedPropertyName10.ts (1 errors) ====
class C {
[e] = 1
~~~
!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
~
!!! error TS2304: Cannot find name 'e'.
}
@@ -1,12 +1,9 @@
parserComputedPropertyName11.ts(2,4): error TS1168: A computed property name in a method overload must refer to an expression whose type is a literal type or a 'unique symbol' type.
parserComputedPropertyName11.ts(2,5): error TS2304: Cannot find name 'e'.
==== parserComputedPropertyName11.ts (2 errors) ====
==== parserComputedPropertyName11.ts (1 errors) ====
class C {
[e]();
~~~
!!! error TS1168: A computed property name in a method overload must refer to an expression whose type is a literal type or a 'unique symbol' type.
~
!!! error TS2304: Cannot find name 'e'.
}
@@ -1,10 +1,7 @@
parserComputedPropertyName13.ts(1,10): error TS1170: A computed property name in a type literal must refer to an expression whose type is a literal type or a 'unique symbol' type.
parserComputedPropertyName13.ts(1,11): error TS2304: Cannot find name 'e'.
==== parserComputedPropertyName13.ts (2 errors) ====
==== parserComputedPropertyName13.ts (1 errors) ====
var v: { [e]: number };
~~~
!!! error TS1170: A computed property name in a type literal must refer to an expression whose type is a literal type or a 'unique symbol' type.
~
!!! error TS2304: Cannot find name 'e'.
@@ -1,10 +1,7 @@
parserComputedPropertyName14.ts(1,10): error TS1170: A computed property name in a type literal must refer to an expression whose type is a literal type or a 'unique symbol' type.
parserComputedPropertyName14.ts(1,11): error TS2304: Cannot find name 'e'.
==== parserComputedPropertyName14.ts (2 errors) ====
==== parserComputedPropertyName14.ts (1 errors) ====
var v: { [e](): number };
~~~
!!! error TS1170: A computed property name in a type literal must refer to an expression whose type is a literal type or a 'unique symbol' type.
~
!!! error TS2304: Cannot find name 'e'.
@@ -1,10 +1,7 @@
parserComputedPropertyName15.ts(1,31): error TS1170: A computed property name in a type literal must refer to an expression whose type is a literal type or a 'unique symbol' type.
parserComputedPropertyName15.ts(1,32): error TS2304: Cannot find name 'e'.
==== parserComputedPropertyName15.ts (2 errors) ====
==== parserComputedPropertyName15.ts (1 errors) ====
var v: { [e: number]: string; [e]: number };
~~~
!!! error TS1170: A computed property name in a type literal must refer to an expression whose type is a literal type or a 'unique symbol' type.
~
!!! error TS2304: Cannot find name 'e'.
@@ -1,10 +1,7 @@
parserComputedPropertyName18.ts(1,10): error TS1170: A computed property name in a type literal must refer to an expression whose type is a literal type or a 'unique symbol' type.
parserComputedPropertyName18.ts(1,11): error TS2304: Cannot find name 'e'.
==== parserComputedPropertyName18.ts (2 errors) ====
==== parserComputedPropertyName18.ts (1 errors) ====
var v: { [e]?(): number };
~~~
!!! error TS1170: A computed property name in a type literal must refer to an expression whose type is a literal type or a 'unique symbol' type.
~
!!! error TS2304: Cannot find name 'e'.
@@ -1,10 +1,7 @@
parserComputedPropertyName19.ts(1,10): error TS1170: A computed property name in a type literal must refer to an expression whose type is a literal type or a 'unique symbol' type.
parserComputedPropertyName19.ts(1,11): error TS2304: Cannot find name 'e'.
==== parserComputedPropertyName19.ts (2 errors) ====
==== parserComputedPropertyName19.ts (1 errors) ====
var v: { [e]? };
~~~
!!! error TS1170: A computed property name in a type literal must refer to an expression whose type is a literal type or a 'unique symbol' type.
~
!!! error TS2304: Cannot find name 'e'.
@@ -1,12 +1,9 @@
parserComputedPropertyName20.ts(2,5): error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type.
parserComputedPropertyName20.ts(2,6): error TS2304: Cannot find name 'e'.
==== parserComputedPropertyName20.ts (2 errors) ====
==== parserComputedPropertyName20.ts (1 errors) ====
interface I {
[e](): number
~~~
!!! error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type.
~
!!! error TS2304: Cannot find name 'e'.
}
@@ -1,12 +1,9 @@
parserComputedPropertyName21.ts(2,5): error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type.
parserComputedPropertyName21.ts(2,6): error TS2304: Cannot find name 'e'.
==== parserComputedPropertyName21.ts (2 errors) ====
==== parserComputedPropertyName21.ts (1 errors) ====
interface I {
[e]: number
~~~
!!! error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type.
~
!!! error TS2304: Cannot find name 'e'.
}
@@ -1,12 +1,9 @@
parserComputedPropertyName22.ts(2,5): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
parserComputedPropertyName22.ts(2,6): error TS2304: Cannot find name 'e'.
==== parserComputedPropertyName22.ts (2 errors) ====
==== parserComputedPropertyName22.ts (1 errors) ====
declare class C {
[e]: number
~~~
!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
~
!!! error TS2304: Cannot find name 'e'.
}
@@ -1,14 +1,11 @@
parserComputedPropertyName25.ts(3,5): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
parserComputedPropertyName25.ts(3,6): error TS2304: Cannot find name 'e'.
parserComputedPropertyName25.ts(4,6): error TS2304: Cannot find name 'e2'.
==== parserComputedPropertyName25.ts (3 errors) ====
==== parserComputedPropertyName25.ts (2 errors) ====
class C {
// No ASI
[e] = 0
~~~
!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
~
!!! error TS2304: Cannot find name 'e'.
[e2] = 1
@@ -1,19 +1,13 @@
parserComputedPropertyName28.ts(2,5): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
parserComputedPropertyName28.ts(2,6): error TS2304: Cannot find name 'e'.
parserComputedPropertyName28.ts(3,5): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
parserComputedPropertyName28.ts(3,6): error TS2304: Cannot find name 'e2'.
==== parserComputedPropertyName28.ts (4 errors) ====
==== parserComputedPropertyName28.ts (2 errors) ====
class C {
[e]: number = 0;
~~~
!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
~
!!! error TS2304: Cannot find name 'e'.
[e2]: number
~~~~
!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
~~
!!! error TS2304: Cannot find name 'e2'.
}
@@ -1,23 +1,17 @@
parserComputedPropertyName29.ts(3,5): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
parserComputedPropertyName29.ts(3,6): error TS2304: Cannot find name 'e'.
parserComputedPropertyName29.ts(3,11): error TS2304: Cannot find name 'id'.
parserComputedPropertyName29.ts(4,5): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
parserComputedPropertyName29.ts(4,6): error TS2304: Cannot find name 'e2'.
==== parserComputedPropertyName29.ts (5 errors) ====
==== parserComputedPropertyName29.ts (3 errors) ====
class C {
// yes ASI
[e] = id++
~~~
!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
~
!!! error TS2304: Cannot find name 'e'.
~~
!!! error TS2304: Cannot find name 'id'.
[e2]: number
~~~~
!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
~~
!!! error TS2304: Cannot find name 'e2'.
}
@@ -1,20 +1,14 @@
parserComputedPropertyName31.ts(3,5): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
parserComputedPropertyName31.ts(3,6): error TS2304: Cannot find name 'e'.
parserComputedPropertyName31.ts(4,5): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
parserComputedPropertyName31.ts(4,6): error TS2304: Cannot find name 'e2'.
==== parserComputedPropertyName31.ts (4 errors) ====
==== parserComputedPropertyName31.ts (2 errors) ====
class C {
// yes ASI
[e]: number
~~~
!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
~
!!! error TS2304: Cannot find name 'e'.
[e2]: number
~~~~
!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
~~
!!! error TS2304: Cannot find name 'e2'.
}
@@ -1,12 +1,9 @@
parserComputedPropertyName32.ts(2,5): error TS1165: A computed property name in an ambient context must refer to an expression whose type is a literal type or a 'unique symbol' type.
parserComputedPropertyName32.ts(2,6): error TS2304: Cannot find name 'e'.
==== parserComputedPropertyName32.ts (2 errors) ====
==== parserComputedPropertyName32.ts (1 errors) ====
declare class C {
[e](): number
~~~
!!! error TS1165: A computed property name in an ambient context must refer to an expression whose type is a literal type or a 'unique symbol' type.
~
!!! error TS2304: Cannot find name 'e'.
}
@@ -1,13 +1,10 @@
parserComputedPropertyName36.ts(2,5): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
parserComputedPropertyName36.ts(2,6): error TS1213: Identifier expected. 'public' is a reserved word in strict mode. Class definitions are automatically in strict mode.
parserComputedPropertyName36.ts(2,6): error TS2304: Cannot find name 'public'.
==== parserComputedPropertyName36.ts (3 errors) ====
==== parserComputedPropertyName36.ts (2 errors) ====
class C {
[public ]: string;
~~~~~~~~~
!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
~~~~~~
!!! error TS1213: Identifier expected. 'public' is a reserved word in strict mode. Class definitions are automatically in strict mode.
~~~~~~
@@ -1,12 +1,9 @@
parserComputedPropertyName7.ts(2,4): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
parserComputedPropertyName7.ts(2,5): error TS2304: Cannot find name 'e'.
==== parserComputedPropertyName7.ts (2 errors) ====
==== parserComputedPropertyName7.ts (1 errors) ====
class C {
[e]
~~~
!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
~
!!! error TS2304: Cannot find name 'e'.
}
@@ -1,12 +1,9 @@
parserComputedPropertyName8.ts(2,11): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
parserComputedPropertyName8.ts(2,12): error TS2304: Cannot find name 'e'.
==== parserComputedPropertyName8.ts (2 errors) ====
==== parserComputedPropertyName8.ts (1 errors) ====
class C {
public [e]
~~~
!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
~
!!! error TS2304: Cannot find name 'e'.
}
@@ -1,13 +1,10 @@
parserComputedPropertyName9.ts(2,4): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
parserComputedPropertyName9.ts(2,5): error TS2304: Cannot find name 'e'.
parserComputedPropertyName9.ts(2,9): error TS2304: Cannot find name 'Type'.
==== parserComputedPropertyName9.ts (3 errors) ====
==== parserComputedPropertyName9.ts (2 errors) ====
class C {
[e]: Type
~~~
!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
~
!!! error TS2304: Cannot find name 'e'.
~~~~
@@ -1,12 +1,9 @@
parserES5ComputedPropertyName1.ts(2,5): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
parserES5ComputedPropertyName1.ts(2,6): error TS2304: Cannot find name 'e'.
==== parserES5ComputedPropertyName1.ts (2 errors) ====
==== parserES5ComputedPropertyName1.ts (1 errors) ====
declare class C {
[e]: number
~~~
!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
~
!!! error TS2304: Cannot find name 'e'.
}
@@ -1,12 +1,9 @@
parserES5ComputedPropertyName10.ts(2,4): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
parserES5ComputedPropertyName10.ts(2,5): error TS2304: Cannot find name 'e'.
==== parserES5ComputedPropertyName10.ts (2 errors) ====
==== parserES5ComputedPropertyName10.ts (1 errors) ====
class C {
[e] = 1
~~~
!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
~
!!! error TS2304: Cannot find name 'e'.
}
@@ -1,12 +1,9 @@
parserES5ComputedPropertyName11.ts(2,4): error TS1168: A computed property name in a method overload must refer to an expression whose type is a literal type or a 'unique symbol' type.
parserES5ComputedPropertyName11.ts(2,5): error TS2304: Cannot find name 'e'.
==== parserES5ComputedPropertyName11.ts (2 errors) ====
==== parserES5ComputedPropertyName11.ts (1 errors) ====
class C {
[e]();
~~~
!!! error TS1168: A computed property name in a method overload must refer to an expression whose type is a literal type or a 'unique symbol' type.
~
!!! error TS2304: Cannot find name 'e'.
}
@@ -1,12 +1,9 @@
parserES5ComputedPropertyName5.ts(2,5): error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type.
parserES5ComputedPropertyName5.ts(2,6): error TS2304: Cannot find name 'e'.
==== parserES5ComputedPropertyName5.ts (2 errors) ====
==== parserES5ComputedPropertyName5.ts (1 errors) ====
interface I {
[e]: number
~~~
!!! error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type.
~
!!! error TS2304: Cannot find name 'e'.
}
@@ -1,12 +1,9 @@
parserES5ComputedPropertyName7.ts(2,4): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
parserES5ComputedPropertyName7.ts(2,5): error TS2304: Cannot find name 'e'.
==== parserES5ComputedPropertyName7.ts (2 errors) ====
==== parserES5ComputedPropertyName7.ts (1 errors) ====
class C {
[e]
~~~
!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
~
!!! error TS2304: Cannot find name 'e'.
}
@@ -1,10 +1,7 @@
parserES5ComputedPropertyName8.ts(1,10): error TS1170: A computed property name in a type literal must refer to an expression whose type is a literal type or a 'unique symbol' type.
parserES5ComputedPropertyName8.ts(1,11): error TS2304: Cannot find name 'e'.
==== parserES5ComputedPropertyName8.ts (2 errors) ====
==== parserES5ComputedPropertyName8.ts (1 errors) ====
var v: { [e]: number };
~~~
!!! error TS1170: A computed property name in a type literal must refer to an expression whose type is a literal type or a 'unique symbol' type.
~
!!! error TS2304: Cannot find name 'e'.
@@ -1,13 +1,10 @@
parserES5ComputedPropertyName9.ts(2,4): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
parserES5ComputedPropertyName9.ts(2,5): error TS2304: Cannot find name 'e'.
parserES5ComputedPropertyName9.ts(2,9): error TS2304: Cannot find name 'Type'.
==== parserES5ComputedPropertyName9.ts (3 errors) ====
==== parserES5ComputedPropertyName9.ts (2 errors) ====
class C {
[e]: Type
~~~
!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
~
!!! error TS2304: Cannot find name 'e'.
~~~~
@@ -1,12 +1,9 @@
parserES5SymbolProperty1.ts(2,5): error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type.
parserES5SymbolProperty1.ts(2,6): error TS2585: 'Symbol' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the 'lib' compiler option to es2015 or later.
==== parserES5SymbolProperty1.ts (2 errors) ====
==== parserES5SymbolProperty1.ts (1 errors) ====
interface I {
[Symbol.iterator]: string;
~~~~~~~~~~~~~~~~~
!!! error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type.
~~~~~~
!!! error TS2585: 'Symbol' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the 'lib' compiler option to es2015 or later.
}
@@ -1,12 +1,9 @@
parserES5SymbolProperty2.ts(2,5): error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type.
parserES5SymbolProperty2.ts(2,6): error TS2585: 'Symbol' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the 'lib' compiler option to es2015 or later.
==== parserES5SymbolProperty2.ts (2 errors) ====
==== parserES5SymbolProperty2.ts (1 errors) ====
interface I {
[Symbol.unscopables](): string;
~~~~~~~~~~~~~~~~~~~~
!!! error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type.
~~~~~~
!!! error TS2585: 'Symbol' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the 'lib' compiler option to es2015 or later.
}
@@ -1,12 +1,9 @@
parserES5SymbolProperty3.ts(2,5): error TS1165: A computed property name in an ambient context must refer to an expression whose type is a literal type or a 'unique symbol' type.
parserES5SymbolProperty3.ts(2,6): error TS2585: 'Symbol' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the 'lib' compiler option to es2015 or later.
==== parserES5SymbolProperty3.ts (2 errors) ====
==== parserES5SymbolProperty3.ts (1 errors) ====
declare class C {
[Symbol.unscopables](): string;
~~~~~~~~~~~~~~~~~~~~
!!! error TS1165: A computed property name in an ambient context must refer to an expression whose type is a literal type or a 'unique symbol' type.
~~~~~~
!!! error TS2585: 'Symbol' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the 'lib' compiler option to es2015 or later.
}
@@ -1,12 +1,9 @@
parserES5SymbolProperty4.ts(2,5): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
parserES5SymbolProperty4.ts(2,6): error TS2585: 'Symbol' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the 'lib' compiler option to es2015 or later.
==== parserES5SymbolProperty4.ts (2 errors) ====
==== parserES5SymbolProperty4.ts (1 errors) ====
declare class C {
[Symbol.isRegExp]: string;
~~~~~~~~~~~~~~~~~
!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
~~~~~~
!!! error TS2585: 'Symbol' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the 'lib' compiler option to es2015 or later.
}
@@ -1,12 +1,9 @@
parserES5SymbolProperty5.ts(2,5): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
parserES5SymbolProperty5.ts(2,6): error TS2585: 'Symbol' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the 'lib' compiler option to es2015 or later.
==== parserES5SymbolProperty5.ts (2 errors) ====
==== parserES5SymbolProperty5.ts (1 errors) ====
class C {
[Symbol.isRegExp]: string;
~~~~~~~~~~~~~~~~~
!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
~~~~~~
!!! error TS2585: 'Symbol' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the 'lib' compiler option to es2015 or later.
}
@@ -1,12 +1,9 @@
parserES5SymbolProperty6.ts(2,5): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
parserES5SymbolProperty6.ts(2,6): error TS2585: 'Symbol' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the 'lib' compiler option to es2015 or later.
==== parserES5SymbolProperty6.ts (2 errors) ====
==== parserES5SymbolProperty6.ts (1 errors) ====
class C {
[Symbol.toStringTag]: string = "";
~~~~~~~~~~~~~~~~~~~~
!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
~~~~~~
!!! error TS2585: 'Symbol' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the 'lib' compiler option to es2015 or later.
}
@@ -1,12 +1,9 @@
parserES5SymbolProperty8.ts(2,5): error TS1170: A computed property name in a type literal must refer to an expression whose type is a literal type or a 'unique symbol' type.
parserES5SymbolProperty8.ts(2,6): error TS2585: 'Symbol' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the 'lib' compiler option to es2015 or later.
==== parserES5SymbolProperty8.ts (2 errors) ====
==== parserES5SymbolProperty8.ts (1 errors) ====
var x: {
[Symbol.toPrimitive](): string
~~~~~~~~~~~~~~~~~~~~
!!! error TS1170: A computed property name in a type literal must refer to an expression whose type is a literal type or a 'unique symbol' type.
~~~~~~
!!! error TS2585: 'Symbol' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the 'lib' compiler option to es2015 or later.
}
@@ -1,12 +1,9 @@
parserES5SymbolProperty9.ts(2,5): error TS1170: A computed property name in a type literal must refer to an expression whose type is a literal type or a 'unique symbol' type.
parserES5SymbolProperty9.ts(2,6): error TS2585: 'Symbol' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the 'lib' compiler option to es2015 or later.
==== parserES5SymbolProperty9.ts (2 errors) ====
==== parserES5SymbolProperty9.ts (1 errors) ====
var x: {
[Symbol.toPrimitive]: string
~~~~~~~~~~~~~~~~~~~~
!!! error TS1170: A computed property name in a type literal must refer to an expression whose type is a literal type or a 'unique symbol' type.
~~~~~~
!!! error TS2585: 'Symbol' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the 'lib' compiler option to es2015 or later.
}
@@ -1,14 +1,11 @@
parserIndexSignature11.ts(2,9): error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type.
parserIndexSignature11.ts(2,10): error TS2304: Cannot find name 'p'.
parserIndexSignature11.ts(3,9): error TS1021: An index signature must have a type annotation.
parserIndexSignature11.ts(4,10): error TS1096: An index signature must have exactly one parameter.
==== parserIndexSignature11.ts (4 errors) ====
==== parserIndexSignature11.ts (3 errors) ====
interface I {
[p]; // Used to be indexer, now it is a computed property
~~~
!!! error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type.
~
!!! error TS2304: Cannot find name 'p'.
[p1: string];
@@ -1,12 +1,9 @@
parserIndexSignature5.ts(2,3): error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type.
parserIndexSignature5.ts(2,4): error TS2304: Cannot find name 'a'.
==== parserIndexSignature5.ts (2 errors) ====
==== parserIndexSignature5.ts (1 errors) ====
interface I {
[a] // Used to be indexer, now it is a computed property
~~~
!!! error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type.
~
!!! error TS2304: Cannot find name 'a'.
}
@@ -6,8 +6,8 @@
var x = {
>x : any
> : ^^^
>{ private [x: string]: string;} : { [x: number]: any; string: any; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>{ private [x: string]: string;} : { [x]: any; string: any; }
> : ^^ ^^^ ^^^^^^^^^^^^^^^
private [x: string]: string;
>[x : any
@@ -30,15 +30,15 @@ function Multimap(ik, iv) {
// without type annotation
this._map2 = { [ik]: iv };
>this._map2 = { [ik]: iv } : { [x: string]: V; }
> : ^^^^^^^^^^^^^^^^^^^
>this._map2 = { [ik]: iv } : { [ik]: V; }
> : ^^ ^ ^^
>this._map2 : any
>this : this
> : ^^^^
>_map2 : any
> : ^^^
>{ [ik]: iv } : { [x: string]: V; }
> : ^^^^^^^^^^^^^^^^^^^
>{ [ik]: iv } : { [ik]: V; }
> : ^^ ^ ^^
>[ik] : V
> : ^
>ik : string
@@ -1,4 +1,3 @@
propertyAssignment.ts(4,13): error TS1170: A computed property name in a type literal must refer to an expression whose type is a literal type or a 'unique symbol' type.
propertyAssignment.ts(4,14): error TS2304: Cannot find name 'index'.
propertyAssignment.ts(12,1): error TS2322: Type '{ x: number; }' is not assignable to type 'new () => any'.
Type '{ x: number; }' provides no match for the signature 'new (): any'.
@@ -6,13 +5,11 @@ propertyAssignment.ts(14,1): error TS2322: Type '{ x: number; }' is not assignab
Type '{ x: number; }' provides no match for the signature '(): void'.
==== propertyAssignment.ts (4 errors) ====
==== propertyAssignment.ts (3 errors) ====
var foo1: { new ():any; }
var bar1: { x : number; }
var foo2: { [index]; } // should be an error, used to be indexer, now it is a computed property
~~~~~~~
!!! error TS1170: A computed property name in a type literal must refer to an expression whose type is a literal type or a 'unique symbol' type.
~~~~~
!!! error TS2304: Cannot find name 'index'.
var bar2: { x : number; }
@@ -105,7 +105,7 @@ function f<T extends { b: string }>(p1: T, p2: T[]) {
> : ^
var o2 = { ...p2 }; // OK
>o2 : { [x: number]: T; length: number; toString(): string; toLocaleString(): string; pop(): T; push(...items: T[]): number; concat(...items: ConcatArray<T>[]): T[]; concat(...items: (T | ConcatArray<T>)[]): T[]; join(separator?: string): string; reverse(): T[]; shift(): T; slice(start?: number, end?: number): T[]; sort(compareFn?: (a: T, b: T) => number): T[]; splice(start: number, deleteCount?: number): T[]; splice(start: number, deleteCount: number, ...items: T[]): T[]; unshift(...items: T[]): number; indexOf(searchElement: T, fromIndex?: number): number; lastIndexOf(searchElement: T, fromIndex?: number): number; every<S extends T>(predicate: (value: T, index: number, array: T[]) => value is S, thisArg?: any): this is S[]; every(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): boolean; some(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): boolean; forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; map<U>(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; filter<S extends T>(predicate: (value: T, index: number, array: T[]) => value is S, thisArg?: any): S[]; filter(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): T[]; reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T; reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T; reduce<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T; reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T; reduceRight<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; }
>o2 : { [n: number]: T; length: number; toString(): string; toLocaleString(): string; pop(): T; push(...items: T[]): number; concat(...items: ConcatArray<T>[]): T[]; concat(...items: (T | ConcatArray<T>)[]): T[]; join(separator?: string): string; reverse(): T[]; shift(): T; slice(start?: number, end?: number): T[]; sort(compareFn?: (a: T, b: T) => number): T[]; splice(start: number, deleteCount?: number): T[]; splice(start: number, deleteCount: number, ...items: T[]): T[]; unshift(...items: T[]): number; indexOf(searchElement: T, fromIndex?: number): number; lastIndexOf(searchElement: T, fromIndex?: number): number; every<S extends T>(predicate: (value: T, index: number, array: T[]) => value is S, thisArg?: any): this is S[]; every(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): boolean; some(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): boolean; forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; map<U>(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; filter<S extends T>(predicate: (value: T, index: number, array: T[]) => value is S, thisArg?: any): S[]; filter(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): T[]; reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T; reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T; reduce<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T; reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T; reduceRight<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^ ^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^ ^^^ ^^^^^^^^^^^^^ ^^^^ ^^^^^ ^^^^^^^^ ^^^^^^^^^^^^^^^ ^^ ^^ ^^^ ^^^^^^^^^^^^^^^ ^^ ^^ ^^ ^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^ ^^^^^^^^^^ ^^^^^ ^^^ ^^^ ^^^^^^^^^^^^^^ ^^^^^ ^^^ ^^^ ^^^^^^^^ ^^^^^^^^^^^^ ^^^ ^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^ ^ ^^^^^^^^ ^^^ ^^^^^ ^^ ^^ ^^^^^^^^^^ ^^ ^^^ ^^^ ^^^^^^^ ^^^ ^^^^^ ^^ ^^ ^^^^^^^^^^ ^^ ^^^ ^^^ ^^^^^^^^^^ ^^^ ^^^^^ ^^ ^^ ^^^^^^^^^^ ^^ ^^^ ^^^ ^^^^^^ ^^ ^^^ ^^^^^ ^^ ^^ ^^^^^^^^^^^^^ ^^^ ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^ ^^^ ^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^^^^^^^^ ^^^ ^^^^^ ^^ ^^ ^^^^^^^^^^ ^^ ^^^ ^^^^^^^^^^^^^^^ ^^^ ^^^^^ ^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^ ^^^^^ ^^ ^^ ^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^ ^^ ^^^ ^^^^^ ^^^^^ ^^ ^^ ^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^ ^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^ ^^^^^ ^^ ^^ ^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^ ^^^^^ ^^^^^ ^^ ^^ ^^^^^^^^^^^^^ ^^^^^^^^^^
>{ ...p2 } : { [n: number]: T; length: number; toString(): string; toLocaleString(): string; pop(): T; push(...items: T[]): number; concat(...items: ConcatArray<T>[]): T[]; concat(...items: (T | ConcatArray<T>)[]): T[]; join(separator?: string): string; reverse(): T[]; shift(): T; slice(start?: number, end?: number): T[]; sort(compareFn?: (a: T, b: T) => number): T[]; splice(start: number, deleteCount?: number): T[]; splice(start: number, deleteCount: number, ...items: T[]): T[]; unshift(...items: T[]): number; indexOf(searchElement: T, fromIndex?: number): number; lastIndexOf(searchElement: T, fromIndex?: number): number; every<S extends T>(predicate: (value: T, index: number, array: T[]) => value is S, thisArg?: any): this is S[]; every(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): boolean; some(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): boolean; forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; map<U>(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; filter<S extends T>(predicate: (value: T, index: number, array: T[]) => value is S, thisArg?: any): S[]; filter(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): T[]; reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T; reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T; reduce<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T; reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T; reduceRight<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^ ^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^ ^^^ ^^^^^^^^^^^^^ ^^^^ ^^^^^ ^^^^^^^^ ^^^^^^^^^^^^^^^ ^^ ^^ ^^^ ^^^^^^^^^^^^^^^ ^^ ^^ ^^ ^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^ ^^^^^^^^^^ ^^^^^ ^^^ ^^^ ^^^^^^^^^^^^^^ ^^^^^ ^^^ ^^^ ^^^^^^^^ ^^^^^^^^^^^^ ^^^ ^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^ ^ ^^^^^^^^ ^^^ ^^^^^ ^^ ^^ ^^^^^^^^^^ ^^ ^^^ ^^^ ^^^^^^^ ^^^ ^^^^^ ^^ ^^ ^^^^^^^^^^ ^^ ^^^ ^^^ ^^^^^^^^^^ ^^^ ^^^^^ ^^ ^^ ^^^^^^^^^^ ^^ ^^^ ^^^ ^^^^^^ ^^ ^^^ ^^^^^ ^^ ^^ ^^^^^^^^^^^^^ ^^^ ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^ ^^^ ^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^^^^^^^^ ^^^ ^^^^^ ^^ ^^ ^^^^^^^^^^ ^^ ^^^ ^^^^^^^^^^^^^^^ ^^^ ^^^^^ ^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^ ^^^^^ ^^ ^^ ^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^ ^^ ^^^ ^^^^^ ^^^^^ ^^ ^^ ^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^ ^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^ ^^^^^ ^^ ^^ ^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^ ^^^^^ ^^^^^ ^^ ^^ ^^^^^^^^^^^^^ ^^^^^^^^^^
@@ -6,10 +6,10 @@ var s: symbol;
> : ^^^^^^
var x = {
>x : { [x: symbol]: number | (() => void); }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>{ [s]: 0, [s]() { }, get [s]() { return 0; }} : { [x: symbol]: number | (() => void); }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>x : { [s]: number; [s]: () => void; [s]: number; }
> : ^^ ^^^^^^ ^ ^^^^^^^^^^ ^ ^^^^^^ ^^
>{ [s]: 0, [s]() { }, get [s]() { return 0; }} : { [s]: number; [s]: () => void; [s]: number; }
> : ^^ ^^^^^^ ^ ^^^^^^^^^^ ^ ^^^^^^ ^^
[s]: 0,
>[s] : number
@@ -10,10 +10,10 @@ var s = Symbol();
> : ^^^^^^^^^^^^^^^^^
var x = {
>x : { [x: symbol]: number | (() => void); }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>{ [s]: 0, [s]() { }, get [s]() { return 0; }} : { [x: symbol]: number | (() => void); }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>x : { [s]: number; [s]: () => void; [s]: number; }
> : ^^ ^^^^^^ ^ ^^^^^^^^^^ ^ ^^^^^^ ^^
>{ [s]: 0, [s]() { }, get [s]() { return 0; }} : { [s]: number; [s]: () => void; [s]: number; }
> : ^^ ^^^^^^ ^ ^^^^^^^^^^ ^ ^^^^^^ ^^
[s]: 0,
>[s] : number
@@ -2,10 +2,10 @@
=== symbolProperty52.ts ===
var obj = {
>obj : { [x: number]: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^
>{ [Symbol.nonsense]: 0} : { [x: number]: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^
>obj : { [Symbol.nonsense]: number; }
> : ^^ ^^^^^^ ^^
>{ [Symbol.nonsense]: 0} : { [Symbol.nonsense]: number; }
> : ^^ ^^^^^^ ^^
[Symbol.nonsense]: 0
>[Symbol.nonsense] : number
@@ -24,16 +24,16 @@ var obj = {
obj = {};
>obj = {} : {}
> : ^^
>obj : { [x: number]: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^
>obj : { [Symbol.nonsense]: number; }
> : ^^ ^^^^^^ ^^
>{} : {}
> : ^^
obj[Symbol.nonsense];
>obj[Symbol.nonsense] : number
> : ^^^^^^
>obj : { [x: number]: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^
>obj : { [Symbol.nonsense]: number; }
> : ^^ ^^^^^^ ^^
>Symbol.nonsense : any
> : ^^^
>Symbol : SymbolConstructor
@@ -8,10 +8,10 @@ interface SymbolConstructor {
}
var obj = {
>obj : { [x: string]: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^
>{ [Symbol.foo]: 0} : { [x: string]: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^
>obj : { [Symbol.foo]: number; }
> : ^^ ^^^^^^ ^^
>{ [Symbol.foo]: 0} : { [Symbol.foo]: number; }
> : ^^ ^^^^^^ ^^
[Symbol.foo]: 0
>[Symbol.foo] : number
@@ -1,12 +1,9 @@
symbolProperty59.ts(2,5): error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type.
symbolProperty59.ts(2,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
==== symbolProperty59.ts (2 errors) ====
==== symbolProperty59.ts (1 errors) ====
interface I {
[Symbol.keyFor]: string;
~~~~~~~~~~~~~~~
!!! error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type.
~~~~~~~~~~~~~~~
!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
}
Loaded 100 of 113 files, more files were not shown because too many files have changed in this diff. Show more