Error ------------------------------------------------------------------------------------------------- generics.js:4:32 Cannot assign `x` to `r` because `unknown` [1] is incompatible with `number` [2]. [incompatible-type] generics.js:4:32 4| function foo(x: X): X { r = x; return x; } ^ References: generics.js:4:20 4| function foo(x: X): X { r = x; return x; } ^ [1] generics.js:3:8 3| var r: number = 0; ^^^^^^ [2] Error --------------------------------------------------------------------------------------------- import_class.js:3:15 Cannot call `C` with empty string bound to `x` because `""` [1] is incompatible with `number` [2]. [incompatible-type] import_class.js:3:15 3| var c = new C(""); ^^ [1] References: export_class.js:3:20 3| constructor(x: number) { this.x = x; } ^^^^^^ [2] Error ------------------------------------------------------------------------------------------------- objects.js:12:17 Cannot assign `c.foo()` to `x` because `number` [1] is incompatible with `string` [2]. [incompatible-type] objects.js:12:17 12| var x: string = c.foo(); // ERROR: number =/= string ^^^^^^^ References: objects.js:6:10 6| foo(): number { ^^^^^^ [1] objects.js:12:8 12| var x: string = c.foo(); // ERROR: number =/= string ^^^^^^ [2] Error -------------------------------------------------------------------------------------------------- objects.js:19:1 Cannot call `o.bar` because in property `foo` > the `this` parameter: `{y: string | number, ...}` [1] is incompatible with `unknown` [2]. [incompatible-type] objects.js:19:1 19| o.bar(); // error: `foo`'s receiver is incompatible with the method annotation ^ References: objects.js:14:20 14| function foo(this: {y: string | number, ...}) { return this.y; } ^^^^^^^^^^^^^^^^^^^^^^^^^ [1] objects.js:15:24 15| function bar(this: {foo(): string | number, ...},) { return this.foo(); } ^^ [2] Error ------------------------------------------------------------------------------------------------- objects.js:20:17 Cannot assign `o2.bar()` to `y` because `string` [1] is incompatible with `number` [2]. [incompatible-type] objects.js:20:17 20| var y: number = o2.bar(); // errors: receiver incompatibility and string ~> number ^^^^^^^^ References: objects.js:15:28 15| function bar(this: {foo(): string | number, ...},) { return this.foo(); } ^^^^^^ [1] objects.js:20:8 20| var y: number = o2.bar(); // errors: receiver incompatibility and string ~> number ^^^^^^ [2] Error ------------------------------------------------------------------------------------------------- objects.js:20:17 Cannot call `o2.bar` because in property `foo` > the `this` parameter: `{y: string | number, ...}` [1] is incompatible with `unknown` [2]. [incompatible-type] objects.js:20:17 20| var y: number = o2.bar(); // errors: receiver incompatibility and string ~> number ^^ References: objects.js:14:20 14| function foo(this: {y: string | number, ...}) { return this.y; } ^^^^^^^^^^^^^^^^^^^^^^^^^ [1] objects.js:15:24 15| function bar(this: {foo(): string | number, ...},) { return this.foo(); } ^^ [2] Found 6 errors