TypeScript/tests/baselines/reference/invalidAssignmentsToVoid.errors.txt
2014-09-11 16:11:08 -07:00

43 lines
1.1 KiB
Plaintext

==== tests/cases/conformance/types/primitives/void/invalidAssignmentsToVoid.ts (10 errors) ====
var x: void;
x = 1;
~
!!! error TS2323: Type 'number' is not assignable to type 'void'.
x = true;
~
!!! error TS2323: Type 'boolean' is not assignable to type 'void'.
x = '';
~
!!! error TS2323: Type 'string' is not assignable to type 'void'.
x = {}
~
!!! error TS2323: Type '{}' is not assignable to type 'void'.
class C { foo: string; }
var c: C;
x = C;
~
!!! error TS2323: Type 'typeof C' is not assignable to type 'void'.
x = c;
~
!!! error TS2323: Type 'C' is not assignable to type 'void'.
interface I { foo: string; }
var i: I;
x = i;
~
!!! error TS2323: Type 'I' is not assignable to type 'void'.
module M { export var x = 1; }
x = M;
~
!!! error TS2323: Type 'typeof M' is not assignable to type 'void'.
function f<T>(a: T) {
x = a;
~
!!! error TS2323: Type 'T' is not assignable to type 'void'.
}
x = f;
~
!!! error TS2323: Type '<T>(a: T) => void' is not assignable to type 'void'.