1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
tests/cases/conformance/types/primitives/enum/invalidEnumAssignments.ts(14,1): error TS2322: Type 'E2.A' is not assignable to type 'E'.
tests/cases/conformance/types/primitives/enum/invalidEnumAssignments.ts(15,1): error TS2322: Type 'E.A' is not assignable to type 'E2'.
tests/cases/conformance/types/primitives/enum/invalidEnumAssignments.ts(16,1): error TS2322: Type 'void' is not assignable to type 'E'.
tests/cases/conformance/types/primitives/enum/invalidEnumAssignments.ts(17,1): error TS2322: Type '{}' is not assignable to type 'E'.
tests/cases/conformance/types/primitives/enum/invalidEnumAssignments.ts(18,1): error TS2322: Type '""' is not assignable to type 'E'.
tests/cases/conformance/types/primitives/enum/invalidEnumAssignments.ts(21,5): error TS2322: Type 'T' is not assignable to type 'E'.
==== 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;
~
!!! error TS2322: Type 'E2.A' is not assignable to type 'E'.
e2 = E.A;
~~
!!! error TS2322: Type 'E.A' is not assignable to type 'E2'.
e = <void>null;
~
!!! error TS2322: Type 'void' is not assignable to type 'E'.
e = {};
~
!!! error TS2322: Type '{}' is not assignable to type 'E'.
e = '';
~
!!! error TS2322: Type '""' is not assignable to type 'E'.
function f<T>(a: T) {
e = a;
~
!!! error TS2322: Type 'T' is not assignable to type 'E'.
}
|