Files
tsgo/testdata/baselines/reference/submodule/conformance/invalidEnumAssignments.errors.txt

47 lines
1.8 KiB
Plaintext

invalidEnumAssignments.ts(14,1): error TS2322: Type 'E2.A' is not assignable to type 'E'.
invalidEnumAssignments.ts(15,1): error TS2322: Type 'E.A' is not assignable to type 'E2'.
invalidEnumAssignments.ts(16,1): error TS2322: Type 'void' is not assignable to type 'E'.
invalidEnumAssignments.ts(16,5): error TS2352: Conversion of type 'null' to type 'void' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
invalidEnumAssignments.ts(17,1): error TS2322: Type '{}' is not assignable to type 'E'.
invalidEnumAssignments.ts(18,1): error TS2322: Type '""' is not assignable to type 'E'.
invalidEnumAssignments.ts(21,5): error TS2322: Type 'T' is not assignable to type 'E'.
==== invalidEnumAssignments.ts (7 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'.
~~~~~~~~~~
!!! error TS2352: Conversion of type 'null' to type 'void' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
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'.
!!! related TS2208 invalidEnumAssignments.ts:20:12: This type parameter might need an `extends E` constraint.
}