TypeScript/tests/baselines/reference/typeGuardInClass.errors.txt
2016-03-10 11:14:40 -08:00

30 lines
1.1 KiB
Plaintext

tests/cases/conformance/expressions/typeGuards/typeGuardInClass.ts(6,17): error TS2322: Type 'string | number' is not assignable to type 'string'.
Type 'number' is not assignable to type 'string'.
tests/cases/conformance/expressions/typeGuards/typeGuardInClass.ts(13,17): error TS2322: Type 'string | number' is not assignable to type 'number'.
Type 'string' is not assignable to type 'number'.
==== tests/cases/conformance/expressions/typeGuards/typeGuardInClass.ts (2 errors) ====
let x: string | number;
if (typeof x === "string") {
let n = class {
constructor() {
let y: string = x;
~
!!! error TS2322: Type 'string | number' is not assignable to type 'string'.
!!! error TS2322: Type 'number' is not assignable to type 'string'.
}
}
}
else {
let m = class {
constructor() {
let y: number = x;
~
!!! error TS2322: Type 'string | number' is not assignable to type 'number'.
!!! error TS2322: Type 'string' is not assignable to type 'number'.
}
}
}