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

67 lines
2.9 KiB
Plaintext

invalidBooleanAssignments.ts(3,5): error TS2322: Type 'boolean' is not assignable to type 'number'.
invalidBooleanAssignments.ts(4,5): error TS2322: Type 'boolean' is not assignable to type 'string'.
invalidBooleanAssignments.ts(5,5): error TS2322: Type 'boolean' is not assignable to type 'void'.
invalidBooleanAssignments.ts(6,5): error TS2322: Type 'true' is not assignable to type 'undefined'.
invalidBooleanAssignments.ts(9,5): error TS2322: Type 'true' is not assignable to type 'E'.
invalidBooleanAssignments.ts(11,11): error TS2564: Property 'foo' has no initializer and is not definitely assigned in the constructor.
invalidBooleanAssignments.ts(12,5): error TS2322: Type 'boolean' is not assignable to type 'C'.
invalidBooleanAssignments.ts(15,5): error TS2322: Type 'boolean' is not assignable to type 'I'.
invalidBooleanAssignments.ts(17,5): error TS2322: Type 'boolean' is not assignable to type '() => string'.
invalidBooleanAssignments.ts(21,1): error TS2631: Cannot assign to 'M' because it is a namespace.
invalidBooleanAssignments.ts(24,5): error TS2322: Type 'boolean' is not assignable to type 'T'.
'T' could be instantiated with an arbitrary type which could be unrelated to 'boolean'.
invalidBooleanAssignments.ts(26,1): error TS2630: Cannot assign to 'i' because it is a function.
==== invalidBooleanAssignments.ts (12 errors) ====
var x = true;
var a: number = x;
~
!!! error TS2322: Type 'boolean' is not assignable to type 'number'.
var b: string = x;
~
!!! error TS2322: Type 'boolean' is not assignable to type 'string'.
var c: void = x;
~
!!! error TS2322: Type 'boolean' is not assignable to type 'void'.
var d: typeof undefined = x;
~
!!! error TS2322: Type 'true' is not assignable to type 'undefined'.
enum E { A }
var e: E = x;
~
!!! error TS2322: Type 'true' is not assignable to type 'E'.
class C { foo: string }
~~~
!!! error TS2564: Property 'foo' has no initializer and is not definitely assigned in the constructor.
var f: C = x;
~
!!! error TS2322: Type 'boolean' is not assignable to type 'C'.
interface I { bar: string }
var g: I = x;
~
!!! error TS2322: Type 'boolean' is not assignable to type 'I'.
var h: { (): string } = x;
~
!!! error TS2322: Type 'boolean' is not assignable to type '() => string'.
var h2: { toString(): string } = x; // no error
namespace M { export var a = 1; }
M = x;
~
!!! error TS2631: Cannot assign to 'M' because it is a namespace.
function i<T>(a: T) {
a = x;
~
!!! error TS2322: Type 'boolean' is not assignable to type 'T'.
!!! error TS2322: 'T' could be instantiated with an arbitrary type which could be unrelated to 'boolean'.
}
i = x;
~
!!! error TS2630: Cannot assign to 'i' because it is a function.