mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
35 lines
1.9 KiB
Plaintext
35 lines
1.9 KiB
Plaintext
assignmentCompatBug5.ts(2,8): error TS2353: Object literal may only specify known properties, and 'b' does not exist in type '{ a: number; }'.
|
|
assignmentCompatBug5.ts(5,7): error TS2322: Type 'string' is not assignable to type 'number'.
|
|
assignmentCompatBug5.ts(5,12): error TS2322: Type 'string' is not assignable to type 'number'.
|
|
assignmentCompatBug5.ts(8,6): error TS2345: Argument of type '(s: string) => void' is not assignable to parameter of type '(n: number) => number'.
|
|
Types of parameters 's' and 'n' are incompatible.
|
|
Type 'number' is not assignable to type 'string'.
|
|
assignmentCompatBug5.ts(9,6): error TS2345: Argument of type '(n: number) => void' is not assignable to parameter of type '(n: number) => number'.
|
|
Type 'void' is not assignable to type 'number'.
|
|
|
|
|
|
==== assignmentCompatBug5.ts (5 errors) ====
|
|
function foo1(x: { a: number; }) { }
|
|
foo1({ b: 5 });
|
|
~
|
|
!!! error TS2353: Object literal may only specify known properties, and 'b' does not exist in type '{ a: number; }'.
|
|
|
|
function foo2(x: number[]) { }
|
|
foo2(["s", "t"]);
|
|
~~~
|
|
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
|
~~~
|
|
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
|
|
|
function foo3(x: (n: number) =>number) { };
|
|
foo3((s:string) => { });
|
|
~~~~~~~~~~~~~~~~~
|
|
!!! error TS2345: Argument of type '(s: string) => void' is not assignable to parameter of type '(n: number) => number'.
|
|
!!! error TS2345: Types of parameters 's' and 'n' are incompatible.
|
|
!!! error TS2345: Type 'number' is not assignable to type 'string'.
|
|
foo3((n) => { return; });
|
|
~~~~~~~~~~~~~~~~~~
|
|
!!! error TS2345: Argument of type '(n: number) => void' is not assignable to parameter of type '(n: number) => number'.
|
|
!!! error TS2345: Type 'void' is not assignable to type 'number'.
|
|
|
|
|