I am seeing a weird (maybe 🤷♂️) behavior of Parameters
utility type. Given code:
const testFn = (...args: readonly number[]) => args;
type l = typeof testFn;
type e = Parameters<l>;
It doesn't change if I use ReadonlyArray<number>
instead, though that is to be expected since they are synonyms.
Why does TypeScript say that type of e
is never
? This was tested on TypeScript v4.3.5.
Link to the playground.
This is a known issue: Inference from rest parameters has strange inconsistent results #37193.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With