61 lines
No EOL
2.2 KiB
Text
61 lines
No EOL
2.2 KiB
Text
tests/cases/conformance/enums/enumErrors.ts(2,6): error TS2431: Enum name cannot be 'any'
|
|
tests/cases/conformance/enums/enumErrors.ts(3,6): error TS2431: Enum name cannot be 'number'
|
|
tests/cases/conformance/enums/enumErrors.ts(4,6): error TS2431: Enum name cannot be 'string'
|
|
tests/cases/conformance/enums/enumErrors.ts(5,6): error TS2431: Enum name cannot be 'boolean'
|
|
tests/cases/conformance/enums/enumErrors.ts(9,9): error TS2322: Type 'Number' is not assignable to type 'E5'.
|
|
tests/cases/conformance/enums/enumErrors.ts(26,9): error TS2322: Type 'string' is not assignable to type 'E11'.
|
|
tests/cases/conformance/enums/enumErrors.ts(27,9): error TS2322: Type 'Date' is not assignable to type 'E11'.
|
|
tests/cases/conformance/enums/enumErrors.ts(28,9): error TS2304: Cannot find name 'window'.
|
|
tests/cases/conformance/enums/enumErrors.ts(29,9): error TS2322: Type '{}' is not assignable to type 'E11'.
|
|
|
|
|
|
==== tests/cases/conformance/enums/enumErrors.ts (9 errors) ====
|
|
// Enum named with PredefinedTypes
|
|
enum any { }
|
|
~~~
|
|
!!! error TS2431: Enum name cannot be 'any'
|
|
enum number { }
|
|
~~~~~~
|
|
!!! error TS2431: Enum name cannot be 'number'
|
|
enum string { }
|
|
~~~~~~
|
|
!!! error TS2431: Enum name cannot be 'string'
|
|
enum boolean { }
|
|
~~~~~~~
|
|
!!! error TS2431: Enum name cannot be 'boolean'
|
|
|
|
// Enum with computed member initializer of type Number
|
|
enum E5 {
|
|
C = new Number(30)
|
|
~~~~~~~~~~~~~~
|
|
!!! error TS2322: Type 'Number' is not assignable to type 'E5'.
|
|
}
|
|
|
|
enum E9 {
|
|
A,
|
|
B = A
|
|
}
|
|
|
|
//Enum with computed member intializer of different enum type
|
|
// Bug 707850: This should be allowed
|
|
enum E10 {
|
|
A = E9.A,
|
|
B = E9.B
|
|
}
|
|
|
|
// Enum with computed member intializer of other types
|
|
enum E11 {
|
|
A = '',
|
|
~~
|
|
!!! error TS2322: Type 'string' is not assignable to type 'E11'.
|
|
B = new Date(),
|
|
~~~~~~~~~~
|
|
!!! error TS2322: Type 'Date' is not assignable to type 'E11'.
|
|
C = window,
|
|
~~~~~~
|
|
!!! error TS2304: Cannot find name 'window'.
|
|
D = {}
|
|
~~
|
|
!!! error TS2322: Type '{}' is not assignable to type 'E11'.
|
|
}
|
|
|