TypeScript/tests/baselines/reference/neverTypeErrors1.errors.txt
Anders Hejlsberg bfd8704245 Adding tests
2016-05-17 13:46:07 -07:00

50 lines
2.3 KiB
Plaintext

tests/cases/conformance/types/never/neverTypeErrors1.ts(3,5): error TS2322: Type 'number' is not assignable to type 'never'.
tests/cases/conformance/types/never/neverTypeErrors1.ts(4,5): error TS2322: Type 'string' is not assignable to type 'never'.
tests/cases/conformance/types/never/neverTypeErrors1.ts(5,5): error TS2322: Type 'boolean' 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,12): error TS2322: Type 'number' 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 'number' is not assignable to type 'never'.
x = "abc";
~
!!! error TS2322: Type 'string' is not assignable to type 'never'.
x = false;
~
!!! error TS2322: Type 'boolean' 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 'number' is not assignable to type 'never'.
}
function f4(): never {
~~~~~
!!! error TS2534: A function returning 'never' cannot have a reachable end point.
}