35 lines
No EOL
692 B
Text
35 lines
No EOL
692 B
Text
==== tests/cases/conformance/types/primitives/enum/invalidEnumAssignments.ts (6 errors) ====
|
|
enum E {
|
|
A,
|
|
B
|
|
}
|
|
|
|
enum E2 {
|
|
A,
|
|
B
|
|
}
|
|
|
|
var e: E;
|
|
var e2: E2;
|
|
|
|
e = E2.A;
|
|
~
|
|
!!! Type 'E2' is not assignable to type 'E'.
|
|
e2 = E.A;
|
|
~~
|
|
!!! Type 'E' is not assignable to type 'E2'.
|
|
e = <void>null;
|
|
~
|
|
!!! Type 'void' is not assignable to type 'E'.
|
|
e = {};
|
|
~
|
|
!!! Type '{}' is not assignable to type 'E'.
|
|
e = '';
|
|
~
|
|
!!! Type 'string' is not assignable to type 'E'.
|
|
|
|
function f<T>(a: T) {
|
|
e = a;
|
|
~
|
|
!!! Type 'T' is not assignable to type 'E'.
|
|
} |