-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rest parameter does not play well with generic array #16931
Comments
my current replacement solution is: type Method<R = void> = (...args:any[]) => R;
type Method0<R = void> = () => R;
type Method1<T1, R = void> = (t1: T1) => R;
type Method2<T1, T2, R = void> = (t1: T1, t2: T2) => R;
type Method3<T1, T2, T3, R = void> = (t1: T1, t2: T2, t3: T3) => R;
type Method4<T1, T2, T3, T4, R = void> = (t1: T1, t2: T2, t3: T3, t4: T4) => R; |
thanks for the edit @ikatyang . seems like a duplicate indeed. |
Closed
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
TypeScript Version: 2.3.4
Code
Expected behavior:
pass validation
Actual behavior:
Error:(1, 47) TS2370:A rest parameter must be of an array type.
The text was updated successfully, but these errors were encountered: