mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
95 lines
3.2 KiB
Plaintext
95 lines
3.2 KiB
Plaintext
dynamicNamesErrors.ts(5,5): error TS2300: Duplicate identifier '1'.
|
|
dynamicNamesErrors.ts(6,5): error TS2300: Duplicate identifier '1'.
|
|
dynamicNamesErrors.ts(18,5): error TS2300: Duplicate identifier '[c0]'.
|
|
dynamicNamesErrors.ts(19,5): error TS2300: Duplicate identifier '[c0]'.
|
|
dynamicNamesErrors.ts(19,5): error TS2717: Subsequent property declarations must have the same type. Property '[c1]' must be of type 'number', but here has type 'string'.
|
|
dynamicNamesErrors.ts(24,1): error TS2322: Type 'T2' is not assignable to type 'T1'.
|
|
Types of property '[c0]' are incompatible.
|
|
Type 'string' is not assignable to type 'number'.
|
|
dynamicNamesErrors.ts(25,1): error TS2322: Type 'T1' is not assignable to type 'T2'.
|
|
Types of property '[c0]' are incompatible.
|
|
Type 'number' is not assignable to type 'string'.
|
|
dynamicNamesErrors.ts(43,5): error TS2564: Property '[x]' has no initializer and is not definitely assigned in the constructor.
|
|
|
|
|
|
==== dynamicNamesErrors.ts (8 errors) ====
|
|
const c0 = "1";
|
|
const c1 = 1;
|
|
|
|
interface T0 {
|
|
[c0]: number;
|
|
~~~~
|
|
!!! error TS2300: Duplicate identifier '1'.
|
|
1: number;
|
|
~
|
|
!!! error TS2300: Duplicate identifier '1'.
|
|
}
|
|
|
|
interface T1 {
|
|
[c0]: number;
|
|
}
|
|
|
|
interface T2 {
|
|
[c0]: string;
|
|
}
|
|
|
|
interface T3 {
|
|
[c0]: number;
|
|
~~~~
|
|
!!! error TS2300: Duplicate identifier '[c0]'.
|
|
[c1]: string;
|
|
~~~~
|
|
!!! error TS2300: Duplicate identifier '[c0]'.
|
|
~~~~
|
|
!!! error TS2717: Subsequent property declarations must have the same type. Property '[c1]' must be of type 'number', but here has type 'string'.
|
|
!!! related TS6203 dynamicNamesErrors.ts:18:5: '[c1]' was also declared here.
|
|
}
|
|
|
|
declare let t1: T1;
|
|
declare let t2: T2;
|
|
t1 = t2;
|
|
~~
|
|
!!! error TS2322: Type 'T2' is not assignable to type 'T1'.
|
|
!!! error TS2322: Types of property '[c0]' are incompatible.
|
|
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
|
t2 = t1;
|
|
~~
|
|
!!! error TS2322: Type 'T1' is not assignable to type 'T2'.
|
|
!!! error TS2322: Types of property '[c0]' are incompatible.
|
|
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
|
|
|
const x = Symbol();
|
|
const y = Symbol();
|
|
const z = Symbol();
|
|
const w = Symbol();
|
|
|
|
export interface InterfaceMemberVisibility {
|
|
[x]: number;
|
|
[y](): number;
|
|
}
|
|
|
|
export class ClassMemberVisibility {
|
|
static [x]: number;
|
|
static [y](): number { return 0; }
|
|
static get [z](): number { return 0; }
|
|
static set [w](value: number) { }
|
|
|
|
[x]: number;
|
|
~~~
|
|
!!! error TS2564: Property '[x]' has no initializer and is not definitely assigned in the constructor.
|
|
[y](): number { return 0; }
|
|
get [z](): number { return 0; }
|
|
set [w](value: number) { }
|
|
}
|
|
|
|
export type ObjectTypeVisibility = {
|
|
[x]: number;
|
|
[y](): number;
|
|
};
|
|
|
|
export const ObjectLiteralVisibility = {
|
|
[x]: 0,
|
|
[y](): number { return 0; },
|
|
get [z](): number { return 0; },
|
|
set [w](value: number) { },
|
|
}; |