Add `FunctionOverloads` type
Resolves https://github.com/sindresorhus/type-fest/issues/868 and resolves partially https://github.com/sindresorhus/type-fest/issues/585
I think https://github.com/microsoft/TypeScript/issues/14107 may be relevant. Maybe link to it in the doc comment.
Thank you for the review!
I think microsoft/TypeScript#14107 may be relevant. Maybe link to it in the doc comment.
I'm not sure how I'd link this issue. I think https://github.com/microsoft/TypeScript/issues/32164 is actually more relevant (and the author of the trick I've used also left the same comment about the method of getting union of overloads), but I don't see additional value of including it the docs too.
I think https://github.com/microsoft/TypeScript/issues/32164 is actually more relevant (and the author of the trick I've used also left the same comment about the method of getting union of overloads), but I don't see additional value of including it the docs too.
It can be useful as context to the limitation.
Mentioned the issue that this type addresses.
Also removed the limitation of losing readonly modifier if other parameters are present from the docs because actually this combination is completely useless in practice:
declare function foo(bar: string, ...baz: readonly number[]): void;
declare const array: number[];
foo('', ...array); // Allowed despite `array` not being readonly