2014-10-01 02:15:18 +02:00
tests/cases/compiler/lastPropertyInLiteralWins.ts(8,5): error TS2300: Duplicate identifier 'thunk'.
2014-09-12 22:35:07 +02:00
tests/cases/compiler/lastPropertyInLiteralWins.ts(9,5): error TS2300: Duplicate identifier 'thunk'.
tests/cases/compiler/lastPropertyInLiteralWins.ts(12,6): error TS2345: Argument of type '{ thunk: (num: number) => void; }' is not assignable to parameter of type 'Thing'.
2014-10-28 08:28:59 +01:00
Types of property 'thunk' are incompatible.
Type '(num: number) => void' is not assignable to type '(str: string) => void'.
2014-10-01 02:15:18 +02:00
tests/cases/compiler/lastPropertyInLiteralWins.ts(13,5): error TS2300: Duplicate identifier 'thunk'.
2014-09-12 22:35:07 +02:00
tests/cases/compiler/lastPropertyInLiteralWins.ts(14,5): error TS2300: Duplicate identifier 'thunk'.
2014-10-01 02:15:18 +02:00
==== tests/cases/compiler/lastPropertyInLiteralWins.ts (5 errors) ====
2014-07-13 01:04:16 +02:00
interface Thing {
thunk: (str: string) => void;
}
function test(thing: Thing) {
thing.thunk("str");
}
test({ // Should error, as last one wins, and is wrong type
thunk: (str: string) => {},
~~~~~
2014-10-01 02:15:18 +02:00
!!! error TS2300: Duplicate identifier 'thunk'.
thunk: (num: number) => {}
2014-10-01 20:27:20 +02:00
~~~~~
2014-09-12 00:19:57 +02:00
!!! error TS2300: Duplicate identifier 'thunk'.
2014-07-13 01:04:16 +02:00
});
test({ // Should be OK. Last 'thunk' is of correct type
2014-07-25 02:00:03 +02:00
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2014-07-13 01:04:16 +02:00
thunk: (num: number) => {},
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2014-10-01 02:15:18 +02:00
~~~~~
!!! error TS2300: Duplicate identifier 'thunk'.
2014-07-13 01:04:16 +02:00
thunk: (str: string) => {}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2014-10-01 20:27:20 +02:00
~~~~~
2014-09-12 00:19:57 +02:00
!!! error TS2300: Duplicate identifier 'thunk'.
2014-07-13 01:04:16 +02:00
});
2014-07-25 02:00:03 +02:00
~
2014-09-12 00:19:57 +02:00
!!! error TS2345: Argument of type '{ thunk: (num: number) => void; }' is not assignable to parameter of type 'Thing'.
2014-10-28 08:28:59 +01:00
!!! error TS2345: Types of property 'thunk' are incompatible.
!!! error TS2345: Type '(num: number) => void' is not assignable to type '(str: string) => void'.
2014-07-13 01:04:16 +02:00