We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
TypeScript Version: 3.9.3
Search Terms: generic rest parameters empty tuple
Code
declare function requireAtLeast1Arg<T extends any[]>(...args: T extends [] ? never : T); requireAtLeast1Arg();
Expected behavior: The code above should trigger the infamous compiler error 2345 as it used to do in TypeScript <= 3.8.
Actual behavior: The code compiles in current TypeScript 3.9.3.
I couldn't find a release note about the new behavior, so I'm assuming this was a kind of unintended breaking change.
Playground Link:
The text was updated successfully, but these errors were encountered:
This is an intended change, see #35438. A better way to require at least one argument is
declare function requireAtLeast1Arg<T extends [any, ...any[]]>(...args: T): void; requireAtLeast1Arg(); // Error requireAtLeast1Arg(42); requireAtLeast1Arg(42, 'hello');
This also produces a much better error message.
Sorry, something went wrong.
I see, thanks. Missed that change.
No branches or pull requests
TypeScript Version: 3.9.3
Search Terms: generic rest parameters empty tuple
Code
Expected behavior: The code above should trigger the infamous compiler error 2345 as it used to do in TypeScript <= 3.8.
Actual behavior: The code compiles in current TypeScript 3.9.3.
I couldn't find a release note about the new behavior, so I'm assuming this was a kind of unintended breaking change.
Playground Link:
The text was updated successfully, but these errors were encountered: