1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
excessPropertyCheckWithSpread.ts(1,25): error TS2842: 'number' is an unused renaming of 'a'. Did you intend to use it as a type annotation?
==== excessPropertyCheckWithSpread.ts (1 errors) ====
declare function f({ a: number }): void
~~~~~~
!!! error TS2842: 'number' is an unused renaming of 'a'. Did you intend to use it as a type annotation?
!!! related TS2843 excessPropertyCheckWithSpread.ts:1:33: We can only write a type for 'a' by adding a type for the entire parameter here.
interface I {
readonly n: number;
}
declare let i: I;
f({ a: 1, ...i });
interface R {
opt?: number
}
interface L {
opt: string
}
declare let l: L;
declare let r: R;
f({ a: 1, ...l, ...r });
|