mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-15 03:23:08 -06:00
Lock down computed names in object literals and classes under --isolatedDeclarations (#58596)
This commit is contained in:
parent
9370347f5b
commit
b682ed4504
@ -1504,7 +1504,6 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
var syntacticNodeBuilder = createSyntacticTypeNodeBuilder(compilerOptions, {
|
||||
isEntityNameVisible,
|
||||
isExpandoFunctionDeclaration,
|
||||
isNonNarrowedBindableName,
|
||||
getAllAccessorDeclarations: getAllAccessorDeclarationsForDeclaration,
|
||||
requiresAddingImplicitUndefined,
|
||||
isUndefinedIdentifierExpression(node: Identifier) {
|
||||
@ -49118,25 +49117,6 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function isNonNarrowedBindableName(node: ComputedPropertyName) {
|
||||
if (!hasBindableName(node.parent)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const expression = node.expression;
|
||||
if (!isEntityNameExpression(expression)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const type = getTypeOfExpression(expression);
|
||||
const symbol = getSymbolAtLocation(expression);
|
||||
if (!symbol) {
|
||||
return false;
|
||||
}
|
||||
// Ensure not type narrowing
|
||||
const declaredType = getTypeOfSymbol(symbol);
|
||||
return declaredType === type;
|
||||
}
|
||||
|
||||
function literalTypeToNode(type: FreshableType, enclosing: Node, tracker: SymbolTracker): Expression {
|
||||
const enumResult = type.flags & TypeFlags.EnumLike ? nodeBuilder.symbolToExpression(type.symbol, SymbolFlags.Value, enclosing, /*flags*/ undefined, tracker)
|
||||
@ -49262,7 +49242,6 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
return node && getExternalModuleFileFromDeclaration(node);
|
||||
},
|
||||
isLiteralConstDeclaration,
|
||||
isNonNarrowedBindableName,
|
||||
isLateBound: (nodeIn: Declaration): nodeIn is LateBoundDeclaration => {
|
||||
const node = getParseTreeNode(nodeIn, isDeclaration);
|
||||
const symbol = node && getSymbolOfDeclaration(node);
|
||||
|
||||
@ -7014,6 +7014,10 @@
|
||||
"category": "Error",
|
||||
"code": 9037
|
||||
},
|
||||
"Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.": {
|
||||
"category": "Error",
|
||||
"code": 9038
|
||||
},
|
||||
"JSX attributes must only be assigned a non-empty 'expression'.": {
|
||||
"category": "Error",
|
||||
"code": 17000
|
||||
|
||||
@ -1123,7 +1123,6 @@ export const notImplementedResolver: EmitResolver = {
|
||||
isArgumentsLocalBinding: notImplemented,
|
||||
getExternalModuleFileFromDeclaration: notImplemented,
|
||||
isLiteralConstDeclaration: notImplemented,
|
||||
isNonNarrowedBindableName: notImplemented,
|
||||
getJsxFactoryEntity: notImplemented,
|
||||
getJsxFragmentFactoryEntity: notImplemented,
|
||||
isBindingCapturedByNode: notImplemented,
|
||||
|
||||
@ -26,7 +26,6 @@ import {
|
||||
isBlock,
|
||||
isConstTypeReference,
|
||||
isDeclarationReadonly,
|
||||
isEntityNameExpression,
|
||||
isGetAccessor,
|
||||
isIdentifier,
|
||||
isJSDocTypeAssertion,
|
||||
@ -55,7 +54,6 @@ import {
|
||||
PropertySignature,
|
||||
SetAccessorDeclaration,
|
||||
SignatureDeclaration,
|
||||
SymbolAccessibility,
|
||||
SyntacticTypeNodeBuilderContext,
|
||||
SyntacticTypeNodeBuilderResolver,
|
||||
SyntaxKind,
|
||||
@ -351,7 +349,7 @@ export function createSyntacticTypeNodeBuilder(options: CompilerOptions, resolve
|
||||
}
|
||||
else if (prop.name.kind === SyntaxKind.ComputedPropertyName) {
|
||||
const expression = prop.name.expression;
|
||||
if (!isPrimitiveLiteralValue(expression, /*includeBigInt*/ false) && !isEntityNameExpression(expression)) {
|
||||
if (!isPrimitiveLiteralValue(expression, /*includeBigInt*/ false)) {
|
||||
context.tracker.reportInferenceFallback(prop.name);
|
||||
result = false;
|
||||
}
|
||||
@ -367,17 +365,6 @@ export function createSyntacticTypeNodeBuilder(options: CompilerOptions, resolve
|
||||
Debug.assert(!isShorthandPropertyAssignment(prop) && !isSpreadAssignment(prop));
|
||||
|
||||
const name = prop.name;
|
||||
if (prop.name.kind === SyntaxKind.ComputedPropertyName) {
|
||||
if (!resolver.isNonNarrowedBindableName(prop.name)) {
|
||||
context.tracker.reportInferenceFallback(prop.name);
|
||||
}
|
||||
else if (isEntityNameExpression(prop.name.expression)) {
|
||||
const visibilityResult = resolver.isEntityNameVisible(prop.name.expression, context.enclosingDeclaration!, /*shouldComputeAliasToMakeVisible*/ false);
|
||||
if (visibilityResult.accessibility !== SymbolAccessibility.Accessible) {
|
||||
context.tracker.reportInferenceFallback(prop.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
switch (prop.kind) {
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
canInferObjectLiteral = !!typeFromObjectLiteralMethod(prop, name, context) && canInferObjectLiteral;
|
||||
|
||||
@ -139,6 +139,7 @@ import {
|
||||
isTupleTypeNode,
|
||||
isTypeAliasDeclaration,
|
||||
isTypeElement,
|
||||
isTypeLiteralNode,
|
||||
isTypeNode,
|
||||
isTypeParameterDeclaration,
|
||||
isTypeQueryNode,
|
||||
@ -995,16 +996,20 @@ export function transformDeclarations(context: TransformationContext) {
|
||||
if (shouldStripInternal(input)) return;
|
||||
if (isDeclaration(input)) {
|
||||
if (isDeclarationAndNotVisible(input)) return;
|
||||
if (hasDynamicName(input) && !resolver.isLateBound(getParseTreeNode(input) as Declaration)) {
|
||||
if (hasDynamicName(input)) {
|
||||
if (
|
||||
isolatedDeclarations
|
||||
// Classes usually elide properties with computed names that are not of a literal type
|
||||
// Classes and object literals usually elide properties with computed names that are not of a literal type
|
||||
// In isolated declarations TSC needs to error on these as we don't know the type in a DTE.
|
||||
&& isClassDeclaration(input.parent)
|
||||
&& isEntityNameExpression(input.name.expression)
|
||||
// If the symbol is not accessible we get another TS error no need to add to that
|
||||
&& resolver.isEntityNameVisible(input.name.expression, input.parent).accessibility === SymbolAccessibility.Accessible
|
||||
&& !resolver.isNonNarrowedBindableName(input.name)
|
||||
&& (isClassDeclaration(input.parent) || isObjectLiteralExpression(input.parent))
|
||||
) {
|
||||
context.addDiagnostic(createDiagnosticForNode(input, Diagnostics.Computed_property_names_on_class_or_object_literals_cannot_be_inferred_with_isolatedDeclarations));
|
||||
}
|
||||
if (
|
||||
isolatedDeclarations
|
||||
// Type declarations just need to double-check that the input computed name is an entity name expression
|
||||
&& (isInterfaceDeclaration(input.parent) || isTypeLiteralNode(input.parent))
|
||||
&& !isEntityNameExpression(input.name.expression)
|
||||
) {
|
||||
context.addDiagnostic(createDiagnosticForNode(input, Diagnostics.Computed_properties_must_be_number_or_string_literals_variables_or_dotted_expressions_with_isolatedDeclarations));
|
||||
}
|
||||
|
||||
@ -623,7 +623,7 @@ export function createGetIsolatedDeclarationErrors(resolver: EmitResolver) {
|
||||
[SyntaxKind.VariableDeclaration]: Diagnostics.Variable_must_have_an_explicit_type_annotation_with_isolatedDeclarations,
|
||||
[SyntaxKind.PropertyDeclaration]: Diagnostics.Property_must_have_an_explicit_type_annotation_with_isolatedDeclarations,
|
||||
[SyntaxKind.PropertySignature]: Diagnostics.Property_must_have_an_explicit_type_annotation_with_isolatedDeclarations,
|
||||
[SyntaxKind.ComputedPropertyName]: Diagnostics.Computed_properties_must_be_number_or_string_literals_variables_or_dotted_expressions_with_isolatedDeclarations,
|
||||
[SyntaxKind.ComputedPropertyName]: Diagnostics.Computed_property_names_on_class_or_object_literals_cannot_be_inferred_with_isolatedDeclarations,
|
||||
[SyntaxKind.SpreadAssignment]: Diagnostics.Objects_that_contain_spread_assignments_can_t_be_inferred_with_isolatedDeclarations,
|
||||
[SyntaxKind.ShorthandPropertyAssignment]: Diagnostics.Objects_that_contain_shorthand_properties_can_t_be_inferred_with_isolatedDeclarations,
|
||||
[SyntaxKind.ArrayLiteralExpression]: Diagnostics.Only_const_arrays_can_be_inferred_with_isolatedDeclarations,
|
||||
|
||||
@ -5754,7 +5754,6 @@ export enum TypeReferenceSerializationKind {
|
||||
|
||||
/** @internal */
|
||||
export interface EmitResolver {
|
||||
isNonNarrowedBindableName(node: ComputedPropertyName): boolean;
|
||||
hasGlobalName(name: string): boolean;
|
||||
getReferencedExportContainer(node: Identifier, prefixLocals?: boolean): SourceFile | ModuleDeclaration | EnumDeclaration | undefined;
|
||||
getReferencedImportDeclaration(node: Identifier): Declaration | undefined;
|
||||
@ -10291,7 +10290,6 @@ export interface SyntacticTypeNodeBuilderContext {
|
||||
/** @internal */
|
||||
export interface SyntacticTypeNodeBuilderResolver {
|
||||
isUndefinedIdentifierExpression(name: Identifier): boolean;
|
||||
isNonNarrowedBindableName(name: ComputedPropertyName): boolean;
|
||||
isExpandoFunctionDeclaration(name: FunctionDeclaration | VariableDeclaration): boolean;
|
||||
getAllAccessorDeclarations(declaration: AccessorDeclaration): AllAccessorDeclarations;
|
||||
isEntityNameVisible(entityName: EntityNameOrEntityNameExpression, enclosingDeclaration: Node, shouldComputeAliasToMakeVisible?: boolean): SymbolVisibilityResult;
|
||||
|
||||
@ -121,6 +121,7 @@ const errorCodes = [
|
||||
Diagnostics.Property_must_have_an_explicit_type_annotation_with_isolatedDeclarations.code,
|
||||
Diagnostics.Expression_type_can_t_be_inferred_with_isolatedDeclarations.code,
|
||||
Diagnostics.Binding_elements_can_t_be_exported_directly_with_isolatedDeclarations.code,
|
||||
Diagnostics.Computed_property_names_on_class_or_object_literals_cannot_be_inferred_with_isolatedDeclarations.code,
|
||||
Diagnostics.Computed_properties_must_be_number_or_string_literals_variables_or_dotted_expressions_with_isolatedDeclarations.code,
|
||||
Diagnostics.Enum_member_initializers_must_be_computable_without_references_to_external_symbols_with_isolatedDeclarations.code,
|
||||
Diagnostics.Extends_clause_can_t_contain_an_expression_with_isolatedDeclarations.code,
|
||||
|
||||
@ -1,19 +1,22 @@
|
||||
computedPropertiesNarrowed.ts(5,5): error TS9014: Computed properties must be number or string literals, variables or dotted expressions with --isolatedDeclarations.
|
||||
computedPropertiesNarrowed.ts(18,20): error TS9014: Computed properties must be number or string literals, variables or dotted expressions with --isolatedDeclarations.
|
||||
computedPropertiesNarrowed.ts(22,5): error TS9014: Computed properties must be number or string literals, variables or dotted expressions with --isolatedDeclarations.
|
||||
computedPropertiesNarrowed.ts(26,5): error TS9014: Computed properties must be number or string literals, variables or dotted expressions with --isolatedDeclarations.
|
||||
computedPropertiesNarrowed.ts(37,5): error TS9014: Computed properties must be number or string literals, variables or dotted expressions with --isolatedDeclarations.
|
||||
computedPropertiesNarrowed.ts(47,5): error TS9014: Computed properties must be number or string literals, variables or dotted expressions with --isolatedDeclarations.
|
||||
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(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.
|
||||
computedPropertiesNarrowed.ts(37,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
|
||||
computedPropertiesNarrowed.ts(42,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
|
||||
computedPropertiesNarrowed.ts(47,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
|
||||
|
||||
|
||||
==== computedPropertiesNarrowed.ts (6 errors) ====
|
||||
==== computedPropertiesNarrowed.ts (9 errors) ====
|
||||
const x: 0 | 1 = Math.random()? 0: 1;
|
||||
declare function assert(n: number): asserts n is 1;
|
||||
assert(x);
|
||||
export let o = {
|
||||
[x]: 1 // error narrow type !== declared type
|
||||
~~~
|
||||
!!! error TS9014: Computed properties must be number or string literals, variables or dotted expressions with --isolatedDeclarations.
|
||||
!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
|
||||
!!! related TS9027 computedPropertiesNarrowed.ts:4:12: Add a type annotation to the variable o.
|
||||
}
|
||||
|
||||
@ -21,6 +24,9 @@ computedPropertiesNarrowed.ts(47,5): error TS9014: Computed properties must be n
|
||||
const y: 0 = 0
|
||||
export let o2 = {
|
||||
[y]: 1 // ok literal computed type
|
||||
~~~
|
||||
!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
|
||||
!!! related TS9027 computedPropertiesNarrowed.ts:10:12: Add a type annotation to the variable o2.
|
||||
}
|
||||
|
||||
// literals are ok
|
||||
@ -29,27 +35,30 @@ computedPropertiesNarrowed.ts(47,5): error TS9014: Computed properties must be n
|
||||
|
||||
export let o32 = { [1-1]: 1 } // error number
|
||||
~~~~~
|
||||
!!! error TS9014: Computed properties must be number or string literals, variables or dotted expressions with --isolatedDeclarations.
|
||||
!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
|
||||
!!! related TS9027 computedPropertiesNarrowed.ts:18:12: Add a type annotation to the variable o32.
|
||||
|
||||
let u = Symbol();
|
||||
export let o4 = {
|
||||
[u]: 1 // Should error, nut a unique symbol
|
||||
~~~
|
||||
!!! error TS9014: Computed properties must be number or string literals, variables or dotted expressions with --isolatedDeclarations.
|
||||
!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
|
||||
!!! related TS9027 computedPropertiesNarrowed.ts:21:12: Add a type annotation to the variable o4.
|
||||
}
|
||||
|
||||
export let o5 ={
|
||||
[Symbol()]: 1 // Should error
|
||||
~~~~~~~~~~
|
||||
!!! error TS9014: Computed properties must be number or string literals, variables or dotted expressions with --isolatedDeclarations.
|
||||
!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
|
||||
!!! related TS9027 computedPropertiesNarrowed.ts:25:12: Add a type annotation to the variable o5.
|
||||
}
|
||||
|
||||
const uu: unique symbol = Symbol();
|
||||
export let o6 = {
|
||||
[uu]: 1 // Should be ok
|
||||
~~~~
|
||||
!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
|
||||
!!! related TS9027 computedPropertiesNarrowed.ts:30:12: Add a type annotation to the variable o6.
|
||||
}
|
||||
|
||||
|
||||
@ -57,20 +66,23 @@ computedPropertiesNarrowed.ts(47,5): error TS9014: Computed properties must be n
|
||||
export let o7 = {
|
||||
[foo()]: 1 // Should error
|
||||
~~~~~~~
|
||||
!!! error TS9014: Computed properties must be number or string literals, variables or dotted expressions with --isolatedDeclarations.
|
||||
!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
|
||||
!!! related TS9027 computedPropertiesNarrowed.ts:36:12: Add a type annotation to the variable o7.
|
||||
};
|
||||
|
||||
let E = { A: 1 } as const
|
||||
export const o8 = {
|
||||
[E.A]: 1 // Fresh
|
||||
~~~~~
|
||||
!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
|
||||
!!! related TS9027 computedPropertiesNarrowed.ts:41:14: Add a type annotation to the variable o8.
|
||||
}
|
||||
|
||||
function ns() { return { v: 0 } as const }
|
||||
export const o9 = {
|
||||
[ns().v]: 1
|
||||
~~~~~~~~
|
||||
!!! error TS9014: Computed properties must be number or string literals, variables or dotted expressions with --isolatedDeclarations.
|
||||
!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
|
||||
!!! related TS9027 computedPropertiesNarrowed.ts:46:14: Add a type annotation to the variable o9.
|
||||
}
|
||||
|
||||
@ -7,23 +7,27 @@ 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(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 TS9014: Computed properties must be number or string literals, variables or dotted expressions with --isolatedDeclarations.
|
||||
isolatedDeclarationErrorsClasses.ts(44,5): error TS9014: Computed properties must be number or string literals, variables or dotted expressions 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 TS9014: Computed properties must be number or string literals, variables or dotted expressions 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 TS9014: Computed properties must be number or string literals, variables or dotted expressions with --isolatedDeclarations.
|
||||
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.
|
||||
|
||||
|
||||
==== isolatedDeclarationErrorsClasses.ts (23 errors) ====
|
||||
==== isolatedDeclarationErrorsClasses.ts (27 errors) ====
|
||||
export class Cls {
|
||||
|
||||
field = 1 + 1;
|
||||
@ -83,23 +87,29 @@ isolatedDeclarationErrorsClasses.ts(56,5): error TS9013: Expression type can't b
|
||||
[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'.
|
||||
|
||||
[noAnnotationLiteralName](): void { }
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
|
||||
|
||||
[noParamAnnotationLiteralName](v: string): void { }
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
|
||||
|
||||
[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 TS9014: Computed properties must be number or string literals, variables or dotted expressions with --isolatedDeclarations.
|
||||
!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
|
||||
|
||||
[noParamAnnotationStringName](v): void { }
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS9014: Computed properties must be number or string literals, variables or dotted expressions with --isolatedDeclarations.
|
||||
!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
|
||||
~
|
||||
!!! error TS7006: Parameter 'v' implicitly has an 'any' type.
|
||||
~
|
||||
@ -108,19 +118,21 @@ isolatedDeclarationErrorsClasses.ts(56,5): error TS9013: Expression type can't b
|
||||
|
||||
get [noAnnotationStringName]() { return 0;}
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS9014: Computed properties must be number or string literals, variables or dotted expressions with --isolatedDeclarations.
|
||||
!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
|
||||
|
||||
set [noParamAnnotationStringName](value) { }
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS7032: Property '[noParamAnnotationStringName]' implicitly has type 'any', because its set accessor lacks a parameter type annotation.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS9014: Computed properties must be number or string literals, variables or dotted expressions with --isolatedDeclarations.
|
||||
!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
|
||||
~~~~~
|
||||
!!! error TS7006: Parameter 'value' implicitly has an 'any' type.
|
||||
|
||||
[("A" + "B") as "AB"] = 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.
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -9,14 +9,17 @@ isolatedDeclarationErrorsObjects.ts(32,9): error TS9008: Method must have an exp
|
||||
isolatedDeclarationErrorsObjects.ts(40,9): error TS7032: Property 'singleSetterBad' implicitly has type 'any', because its set accessor lacks a parameter type annotation.
|
||||
isolatedDeclarationErrorsObjects.ts(40,25): error TS7006: Parameter 'value' implicitly has an 'any' type.
|
||||
isolatedDeclarationErrorsObjects.ts(40,25): error TS9009: At least one accessor must have an explicit return type annotation with --isolatedDeclarations.
|
||||
isolatedDeclarationErrorsObjects.ts(64,5): error TS9014: Computed properties must be number or string literals, variables or dotted expressions with --isolatedDeclarations.
|
||||
isolatedDeclarationErrorsObjects.ts(65,5): error TS9014: Computed properties must be number or string literals, variables or dotted expressions with --isolatedDeclarations.
|
||||
isolatedDeclarationErrorsObjects.ts(64,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
|
||||
isolatedDeclarationErrorsObjects.ts(65,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
|
||||
isolatedDeclarationErrorsObjects.ts(66,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
|
||||
isolatedDeclarationErrorsObjects.ts(67,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
|
||||
isolatedDeclarationErrorsObjects.ts(68,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
|
||||
isolatedDeclarationErrorsObjects.ts(75,5): error TS9015: Objects that contain spread assignments can't be inferred with --isolatedDeclarations.
|
||||
isolatedDeclarationErrorsObjects.ts(77,5): error TS9016: Objects that contain shorthand properties can't be inferred with --isolatedDeclarations.
|
||||
isolatedDeclarationErrorsObjects.ts(84,9): error TS9015: Objects that contain spread assignments can't be inferred with --isolatedDeclarations.
|
||||
|
||||
|
||||
==== isolatedDeclarationErrorsObjects.ts (16 errors) ====
|
||||
==== isolatedDeclarationErrorsObjects.ts (19 errors) ====
|
||||
export let o = {
|
||||
a: 1,
|
||||
b: ""
|
||||
@ -121,15 +124,24 @@ isolatedDeclarationErrorsObjects.ts(84,9): error TS9015: Objects that contain sp
|
||||
[1]: 1,
|
||||
[1 + 3]: 1,
|
||||
~~~~~~~
|
||||
!!! error TS9014: Computed properties must be number or string literals, variables or dotted expressions with --isolatedDeclarations.
|
||||
!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
|
||||
!!! related TS9027 isolatedDeclarationErrorsObjects.ts:62:14: Add a type annotation to the variable oWithComputedProperties.
|
||||
[prop(2)]: 2,
|
||||
~~~~~~~~~
|
||||
!!! error TS9014: Computed properties must be number or string literals, variables or dotted expressions with --isolatedDeclarations.
|
||||
!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
|
||||
!!! related TS9027 isolatedDeclarationErrorsObjects.ts:62:14: Add a type annotation to the variable oWithComputedProperties.
|
||||
[s]: 1,
|
||||
~~~
|
||||
!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
|
||||
!!! related TS9027 isolatedDeclarationErrorsObjects.ts:62:14: Add a type annotation to the variable oWithComputedProperties.
|
||||
[E.V]: 1,
|
||||
~~~~~
|
||||
!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
|
||||
!!! related TS9027 isolatedDeclarationErrorsObjects.ts:62:14: Add a type annotation to the variable oWithComputedProperties.
|
||||
[str]: 0,
|
||||
~~~~~
|
||||
!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
|
||||
!!! related TS9027 isolatedDeclarationErrorsObjects.ts:62:14: Add a type annotation to the variable oWithComputedProperties.
|
||||
}
|
||||
|
||||
const part = { a: 1 };
|
||||
|
||||
@ -1,10 +1,12 @@
|
||||
isolatedDeclarationLazySymbols.ts(1,17): error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations.
|
||||
isolatedDeclarationLazySymbols.ts(13,1): error TS9023: Assigning properties to functions without declaring them is not supported with --isolatedDeclarations. Add an explicit declaration for the properties assigned to this function.
|
||||
isolatedDeclarationLazySymbols.ts(16,5): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
|
||||
isolatedDeclarationLazySymbols.ts(21,5): error TS9014: Computed properties must be number or string literals, variables or dotted expressions with --isolatedDeclarations.
|
||||
isolatedDeclarationLazySymbols.ts(16,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
|
||||
isolatedDeclarationLazySymbols.ts(21,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
|
||||
isolatedDeclarationLazySymbols.ts(22,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
|
||||
|
||||
|
||||
==== isolatedDeclarationLazySymbols.ts (4 errors) ====
|
||||
==== isolatedDeclarationLazySymbols.ts (6 errors) ====
|
||||
export function foo() {
|
||||
~~~
|
||||
!!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations.
|
||||
@ -28,13 +30,18 @@ isolatedDeclarationLazySymbols.ts(21,5): error TS9014: Computed properties must
|
||||
[o["prop.inner"]] ="A"
|
||||
~~~~~~~~~~~~~~~~~
|
||||
!!! 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.
|
||||
[o.prop.inner] = "B"
|
||||
}
|
||||
|
||||
export let oo = {
|
||||
[o['prop.inner']]:"A",
|
||||
~~~~~~~~~~~~~~~~~
|
||||
!!! error TS9014: Computed properties must be number or string literals, variables or dotted expressions with --isolatedDeclarations.
|
||||
!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
|
||||
!!! related TS9027 isolatedDeclarationLazySymbols.ts:20:12: Add a type annotation to the variable oo.
|
||||
[o.prop.inner]: "B",
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
|
||||
!!! related TS9027 isolatedDeclarationLazySymbols.ts:20:12: Add a type annotation to the variable oo.
|
||||
}
|
||||
@ -77,9 +77,10 @@ export {};
|
||||
|
||||
//// [Diagnostics reported]
|
||||
class.ts(1,7): error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations.
|
||||
class.ts(11,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
|
||||
|
||||
|
||||
==== class.ts (1 errors) ====
|
||||
==== class.ts (2 errors) ====
|
||||
const i = Symbol();
|
||||
~
|
||||
!!! error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations.
|
||||
@ -94,6 +95,8 @@ class.ts(1,7): error TS9010: Variable must have an explicit type annotation with
|
||||
private g: string;
|
||||
["h"]: string;
|
||||
[i]: string;
|
||||
~~~
|
||||
!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
|
||||
}
|
||||
|
||||
export abstract class Baz {
|
||||
|
||||
195
tests/baselines/reference/transpile/declarationComputedPropertyNames.d.ts
vendored
Normal file
195
tests/baselines/reference/transpile/declarationComputedPropertyNames.d.ts
vendored
Normal file
@ -0,0 +1,195 @@
|
||||
//// [declarationComputedPropertyNames.ts] ////
|
||||
export namespace presentNs {
|
||||
export const a = Symbol();
|
||||
}
|
||||
|
||||
export type A = {
|
||||
[missing]: number,
|
||||
[ns.missing]: number,
|
||||
[presentNs.a]: number,
|
||||
[Symbol.iterator]: number,
|
||||
[1]: number,
|
||||
["2"]: number,
|
||||
[(missing2)]: number,
|
||||
[Math.random() > 0.5 ? "f1" : "f2"]: number,
|
||||
};
|
||||
|
||||
export interface B {
|
||||
[missing]: number,
|
||||
[ns.missing]: number,
|
||||
[presentNs.a]: number,
|
||||
[Symbol.iterator]: number,
|
||||
[1]: number,
|
||||
["2"]: number,
|
||||
[(missing2)]: number,
|
||||
[Math.random() > 0.5 ? "f1" : "f2"]: number,
|
||||
}
|
||||
|
||||
export class C {
|
||||
[missing]: number = 1;
|
||||
[ns.missing]: number = 1;
|
||||
[presentNs.a]: number = 1;
|
||||
[Symbol.iterator]: number = 1;
|
||||
[1]: number = 1;
|
||||
["2"]: number = 1;
|
||||
[(missing2)]: number = 1;
|
||||
[Math.random() > 0.5 ? "f1" : "f2"]: number = 1;
|
||||
}
|
||||
|
||||
export const D = {
|
||||
[missing]: 1,
|
||||
[ns.missing]: 1,
|
||||
[presentNs.a]: 1,
|
||||
[Symbol.iterator]: 1,
|
||||
[1]: 1,
|
||||
["2"]: 1,
|
||||
[(missing2)]: 1,
|
||||
[Math.random() > 0.5 ? "f1" : "f2"]: 1,
|
||||
};
|
||||
//// [declarationComputedPropertyNames.d.ts] ////
|
||||
export declare namespace presentNs {
|
||||
const a: unique symbol;
|
||||
}
|
||||
export type A = {
|
||||
[missing]: number;
|
||||
[ns.missing]: number;
|
||||
[presentNs.a]: number;
|
||||
[Symbol.iterator]: number;
|
||||
[1]: number;
|
||||
["2"]: number;
|
||||
};
|
||||
export interface B {
|
||||
[missing]: number;
|
||||
[ns.missing]: number;
|
||||
[presentNs.a]: number;
|
||||
[Symbol.iterator]: number;
|
||||
[1]: number;
|
||||
["2"]: number;
|
||||
}
|
||||
export declare class C {
|
||||
[missing]: number;
|
||||
[ns.missing]: number;
|
||||
[presentNs.a]: number;
|
||||
[Symbol.iterator]: number;
|
||||
[1]: number;
|
||||
["2"]: number;
|
||||
}
|
||||
export declare const D: {
|
||||
[x: string]: number;
|
||||
[x: number]: number;
|
||||
[presentNs.a]: number;
|
||||
1: number;
|
||||
"2": number;
|
||||
};
|
||||
|
||||
|
||||
//// [Diagnostics reported]
|
||||
declarationComputedPropertyNames.ts(2,18): error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations.
|
||||
declarationComputedPropertyNames.ts(12,5): error TS9014: Computed properties must be number or string literals, variables or dotted expressions with --isolatedDeclarations.
|
||||
declarationComputedPropertyNames.ts(13,5): error TS9014: Computed properties must be number or string literals, variables or dotted expressions with --isolatedDeclarations.
|
||||
declarationComputedPropertyNames.ts(23,5): error TS9014: Computed properties must be number or string literals, variables or dotted expressions with --isolatedDeclarations.
|
||||
declarationComputedPropertyNames.ts(24,5): error TS9014: Computed properties must be number or string literals, variables or dotted expressions with --isolatedDeclarations.
|
||||
declarationComputedPropertyNames.ts(28,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
|
||||
declarationComputedPropertyNames.ts(29,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
|
||||
declarationComputedPropertyNames.ts(30,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
|
||||
declarationComputedPropertyNames.ts(31,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
|
||||
declarationComputedPropertyNames.ts(34,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
|
||||
declarationComputedPropertyNames.ts(35,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
|
||||
declarationComputedPropertyNames.ts(39,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
|
||||
declarationComputedPropertyNames.ts(40,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
|
||||
declarationComputedPropertyNames.ts(41,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
|
||||
declarationComputedPropertyNames.ts(42,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
|
||||
declarationComputedPropertyNames.ts(45,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
|
||||
declarationComputedPropertyNames.ts(46,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
|
||||
|
||||
|
||||
==== declarationComputedPropertyNames.ts (17 errors) ====
|
||||
export namespace presentNs {
|
||||
export const a = Symbol();
|
||||
~
|
||||
!!! error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations.
|
||||
!!! related TS9027 declarationComputedPropertyNames.ts:2:18: Add a type annotation to the variable a.
|
||||
}
|
||||
|
||||
export type A = {
|
||||
[missing]: number,
|
||||
[ns.missing]: number,
|
||||
[presentNs.a]: number,
|
||||
[Symbol.iterator]: number,
|
||||
[1]: number,
|
||||
["2"]: number,
|
||||
[(missing2)]: number,
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS9014: Computed properties must be number or string literals, variables or dotted expressions with --isolatedDeclarations.
|
||||
[Math.random() > 0.5 ? "f1" : "f2"]: number,
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS9014: Computed properties must be number or string literals, variables or dotted expressions with --isolatedDeclarations.
|
||||
};
|
||||
|
||||
export interface B {
|
||||
[missing]: number,
|
||||
[ns.missing]: number,
|
||||
[presentNs.a]: number,
|
||||
[Symbol.iterator]: number,
|
||||
[1]: number,
|
||||
["2"]: number,
|
||||
[(missing2)]: number,
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS9014: Computed properties must be number or string literals, variables or dotted expressions with --isolatedDeclarations.
|
||||
[Math.random() > 0.5 ? "f1" : "f2"]: number,
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS9014: Computed properties must be number or string literals, variables or dotted expressions with --isolatedDeclarations.
|
||||
}
|
||||
|
||||
export class C {
|
||||
[missing]: number = 1;
|
||||
~~~~~~~~~
|
||||
!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
|
||||
[ns.missing]: number = 1;
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
|
||||
[presentNs.a]: number = 1;
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
|
||||
[Symbol.iterator]: number = 1;
|
||||
~~~~~~~~~~~~~~~~~
|
||||
!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
|
||||
[1]: number = 1;
|
||||
["2"]: number = 1;
|
||||
[(missing2)]: number = 1;
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
|
||||
[Math.random() > 0.5 ? "f1" : "f2"]: number = 1;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
|
||||
}
|
||||
|
||||
export const D = {
|
||||
[missing]: 1,
|
||||
~~~~~~~~~
|
||||
!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
|
||||
!!! related TS9027 declarationComputedPropertyNames.ts:38:14: Add a type annotation to the variable D.
|
||||
[ns.missing]: 1,
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
|
||||
!!! related TS9027 declarationComputedPropertyNames.ts:38:14: Add a type annotation to the variable D.
|
||||
[presentNs.a]: 1,
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
|
||||
!!! related TS9027 declarationComputedPropertyNames.ts:38:14: Add a type annotation to the variable D.
|
||||
[Symbol.iterator]: 1,
|
||||
~~~~~~~~~~~~~~~~~
|
||||
!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
|
||||
!!! related TS9027 declarationComputedPropertyNames.ts:38:14: Add a type annotation to the variable D.
|
||||
[1]: 1,
|
||||
["2"]: 1,
|
||||
[(missing2)]: 1,
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
|
||||
!!! related TS9027 declarationComputedPropertyNames.ts:38:14: Add a type annotation to the variable D.
|
||||
[Math.random() > 0.5 ? "f1" : "f2"]: 1,
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.
|
||||
!!! related TS9027 declarationComputedPropertyNames.ts:38:14: Add a type annotation to the variable D.
|
||||
};
|
||||
|
||||
51
tests/cases/transpile/declarationComputedPropertyNames.ts
Normal file
51
tests/cases/transpile/declarationComputedPropertyNames.ts
Normal file
@ -0,0 +1,51 @@
|
||||
// @declaration: true
|
||||
// @emitDeclarationOnly: true
|
||||
// @target: es6
|
||||
|
||||
export namespace presentNs {
|
||||
export const a = Symbol();
|
||||
}
|
||||
|
||||
export type A = {
|
||||
[missing]: number,
|
||||
[ns.missing]: number,
|
||||
[presentNs.a]: number,
|
||||
[Symbol.iterator]: number,
|
||||
[1]: number,
|
||||
["2"]: number,
|
||||
[(missing2)]: number,
|
||||
[Math.random() > 0.5 ? "f1" : "f2"]: number,
|
||||
};
|
||||
|
||||
export interface B {
|
||||
[missing]: number,
|
||||
[ns.missing]: number,
|
||||
[presentNs.a]: number,
|
||||
[Symbol.iterator]: number,
|
||||
[1]: number,
|
||||
["2"]: number,
|
||||
[(missing2)]: number,
|
||||
[Math.random() > 0.5 ? "f1" : "f2"]: number,
|
||||
}
|
||||
|
||||
export class C {
|
||||
[missing]: number = 1;
|
||||
[ns.missing]: number = 1;
|
||||
[presentNs.a]: number = 1;
|
||||
[Symbol.iterator]: number = 1;
|
||||
[1]: number = 1;
|
||||
["2"]: number = 1;
|
||||
[(missing2)]: number = 1;
|
||||
[Math.random() > 0.5 ? "f1" : "f2"]: number = 1;
|
||||
}
|
||||
|
||||
export const D = {
|
||||
[missing]: 1,
|
||||
[ns.missing]: 1,
|
||||
[presentNs.a]: 1,
|
||||
[Symbol.iterator]: 1,
|
||||
[1]: 1,
|
||||
["2"]: 1,
|
||||
[(missing2)]: 1,
|
||||
[Math.random() > 0.5 ? "f1" : "f2"]: 1,
|
||||
};
|
||||
Loading…
x
Reference in New Issue
Block a user