mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
64 lines
2.8 KiB
Plaintext
64 lines
2.8 KiB
Plaintext
invalidNumberAssignments.ts(3,5): error TS2322: Type 'number' is not assignable to type 'boolean'.
|
|
invalidNumberAssignments.ts(4,5): error TS2322: Type 'number' is not assignable to type 'string'.
|
|
invalidNumberAssignments.ts(5,5): error TS2322: Type 'number' is not assignable to type 'void'.
|
|
invalidNumberAssignments.ts(6,5): error TS2322: Type 'number' is not assignable to type 'undefined'.
|
|
invalidNumberAssignments.ts(8,11): error TS2564: Property 'foo' has no initializer and is not definitely assigned in the constructor.
|
|
invalidNumberAssignments.ts(9,5): error TS2322: Type 'number' is not assignable to type 'C'.
|
|
invalidNumberAssignments.ts(12,5): error TS2322: Type 'number' is not assignable to type 'I'.
|
|
invalidNumberAssignments.ts(14,5): error TS2322: Type 'number' is not assignable to type '{ baz: string; }'.
|
|
invalidNumberAssignments.ts(15,5): error TS2322: Type 'number' is not assignable to type '{ 0: number; }'.
|
|
invalidNumberAssignments.ts(18,1): error TS2631: Cannot assign to 'M' because it is a namespace.
|
|
invalidNumberAssignments.ts(21,5): error TS2322: Type 'number' is not assignable to type 'T'.
|
|
'T' could be instantiated with an arbitrary type which could be unrelated to 'number'.
|
|
invalidNumberAssignments.ts(23,1): error TS2630: Cannot assign to 'i' because it is a function.
|
|
|
|
|
|
==== invalidNumberAssignments.ts (12 errors) ====
|
|
var x = 1;
|
|
|
|
var a: boolean = x;
|
|
~
|
|
!!! error TS2322: Type 'number' is not assignable to type 'boolean'.
|
|
var b: string = x;
|
|
~
|
|
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
|
var c: void = x;
|
|
~
|
|
!!! error TS2322: Type 'number' is not assignable to type 'void'.
|
|
var d: typeof undefined = x;
|
|
~
|
|
!!! error TS2322: Type 'number' is not assignable to type 'undefined'.
|
|
|
|
class C { foo: string; }
|
|
~~~
|
|
!!! error TS2564: Property 'foo' has no initializer and is not definitely assigned in the constructor.
|
|
var e: C = x;
|
|
~
|
|
!!! error TS2322: Type 'number' is not assignable to type 'C'.
|
|
|
|
interface I { bar: string; }
|
|
var f: I = x;
|
|
~
|
|
!!! error TS2322: Type 'number' is not assignable to type 'I'.
|
|
|
|
var g: { baz: string } = 1;
|
|
~
|
|
!!! error TS2322: Type 'number' is not assignable to type '{ baz: string; }'.
|
|
var g2: { 0: number } = 1;
|
|
~~
|
|
!!! error TS2322: Type 'number' is not assignable to type '{ 0: number; }'.
|
|
|
|
namespace M { export var x = 1; }
|
|
M = x;
|
|
~
|
|
!!! error TS2631: Cannot assign to 'M' because it is a namespace.
|
|
|
|
function i<T>(a: T) {
|
|
a = x;
|
|
~
|
|
!!! error TS2322: Type 'number' is not assignable to type 'T'.
|
|
!!! error TS2322: 'T' could be instantiated with an arbitrary type which could be unrelated to 'number'.
|
|
}
|
|
i = x;
|
|
~
|
|
!!! error TS2630: Cannot assign to 'i' because it is a function. |