1 2 3 4 5 6 7 8 9 10 11
|
tests/cases/compiler/contextualTyping21.ts(1,36): error TS2322: Type '(number | { id: number; })[]' is not assignable to type '{ id: number; }[]'.
Type 'number | { id: number; }' is not assignable to type '{ id: number; }'.
Type 'number' is not assignable to type '{ id: number; }'.
==== tests/cases/compiler/contextualTyping21.ts (1 errors) ====
var foo:{id:number;}[] = [{id:1}]; foo = [{id:1}, 1];
~~~
!!! error TS2322: Type '(number | { id: number; })[]' is not assignable to type '{ id: number; }[]'.
!!! error TS2322: Type 'number | { id: number; }' is not assignable to type '{ id: number; }'.
!!! error TS2322: Type 'number' is not assignable to type '{ id: number; }'.
|