TypeScript/tests/baselines/reference/enumErrors.errors.txt

54 lines
1.5 KiB
Text
Raw Normal View History

2014-07-13 01:04:16 +02:00
==== tests/cases/conformance/enums/enumErrors.ts (11 errors) ====
// Enum named with PredefinedTypes
enum any { }
~~~
!!! error TS2431: Enum name cannot be 'any'
2014-07-13 01:04:16 +02:00
enum number { }
~~~~~~
!!! error TS2431: Enum name cannot be 'number'
2014-07-13 01:04:16 +02:00
enum string { }
~~~~~~
!!! error TS2431: Enum name cannot be 'string'
2014-07-13 01:04:16 +02:00
enum boolean { }
~~~~~~~
!!! error TS2431: Enum name cannot be 'boolean'
2014-07-13 01:04:16 +02:00
// Enum with computed member initializer of type Number
enum E5 {
C = new Number(30)
~~~~~~~~~~~~~~
!!! error TS2323: Type 'Number' is not assignable to type 'E5'.
2014-07-13 01:04:16 +02:00
}
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,
~~~~
!!! error TS2323: Type 'E9' is not assignable to type 'E10'.
2014-07-13 01:04:16 +02:00
B = E9.B
~~~~
!!! error TS2323: Type 'E9' is not assignable to type 'E10'.
2014-07-13 01:04:16 +02:00
}
// Enum with computed member intializer of other types
enum E11 {
A = '',
~~
!!! error TS2323: Type 'string' is not assignable to type 'E11'.
2014-07-13 01:04:16 +02:00
B = new Date(),
~~~~~~~~~~
!!! error TS2323: Type 'Date' is not assignable to type 'E11'.
2014-07-13 01:04:16 +02:00
C = window,
~~~~~~
!!! error TS2304: Cannot find name 'window'.
2014-07-13 01:04:16 +02:00
D = {}
~~
!!! error TS2323: Type '{}' is not assignable to type 'E11'.
2014-07-13 01:04:16 +02:00
}