50 lines
2.2 KiB
Plaintext
50 lines
2.2 KiB
Plaintext
tests/cases/conformance/types/never/neverTypeErrors1.ts(3,5): error TS2322: Type '1' is not assignable to type 'never'.
|
|
tests/cases/conformance/types/never/neverTypeErrors1.ts(4,5): error TS2322: Type '"abc"' is not assignable to type 'never'.
|
|
tests/cases/conformance/types/never/neverTypeErrors1.ts(5,5): error TS2322: Type 'false' is not assignable to type 'never'.
|
|
tests/cases/conformance/types/never/neverTypeErrors1.ts(6,5): error TS2322: Type 'undefined' is not assignable to type 'never'.
|
|
tests/cases/conformance/types/never/neverTypeErrors1.ts(7,5): error TS2322: Type 'null' is not assignable to type 'never'.
|
|
tests/cases/conformance/types/never/neverTypeErrors1.ts(8,5): error TS2322: Type '{}' is not assignable to type 'never'.
|
|
tests/cases/conformance/types/never/neverTypeErrors1.ts(12,5): error TS2322: Type 'undefined' is not assignable to type 'never'.
|
|
tests/cases/conformance/types/never/neverTypeErrors1.ts(16,5): error TS2322: Type '1' is not assignable to type 'never'.
|
|
tests/cases/conformance/types/never/neverTypeErrors1.ts(19,16): error TS2534: A function returning 'never' cannot have a reachable end point.
|
|
|
|
|
|
==== tests/cases/conformance/types/never/neverTypeErrors1.ts (9 errors) ====
|
|
function f1() {
|
|
let x: never;
|
|
x = 1;
|
|
~
|
|
!!! error TS2322: Type '1' is not assignable to type 'never'.
|
|
x = "abc";
|
|
~
|
|
!!! error TS2322: Type '"abc"' is not assignable to type 'never'.
|
|
x = false;
|
|
~
|
|
!!! error TS2322: Type 'false' is not assignable to type 'never'.
|
|
x = undefined;
|
|
~
|
|
!!! error TS2322: Type 'undefined' is not assignable to type 'never'.
|
|
x = null;
|
|
~
|
|
!!! error TS2322: Type 'null' is not assignable to type 'never'.
|
|
x = {};
|
|
~
|
|
!!! error TS2322: Type '{}' is not assignable to type 'never'.
|
|
}
|
|
|
|
function f2(): never {
|
|
return;
|
|
~~~~~~~
|
|
!!! error TS2322: Type 'undefined' is not assignable to type 'never'.
|
|
}
|
|
|
|
function f3(): never {
|
|
return 1;
|
|
~~~~~~~~~
|
|
!!! error TS2322: Type '1' is not assignable to type 'never'.
|
|
}
|
|
|
|
function f4(): never {
|
|
~~~~~
|
|
!!! error TS2534: A function returning 'never' cannot have a reachable end point.
|
|
} |