Skip to content

(...args: never) => void signature throws an error in TS 5.1 #54543

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

Closed
anthonyma94 opened this issue Jun 5, 2023 · 3 comments
Closed

(...args: never) => void signature throws an error in TS 5.1 #54543

anthonyma94 opened this issue Jun 5, 2023 · 3 comments
Labels
Duplicate An existing issue was already created

Comments

@anthonyma94
Copy link

Playground

If I have a function with the signature of (...args: never) => void, TypeScript 5.1 now throws this error:

Argument of type '[]' is not assignable to parameter of type 'never'.

Previous versions of TypeScript allows me to call the function without any parameters.

Is this intended behaviour? I don't believe seeing anything in the changelog mentioning this.

@anthonyma94 anthonyma94 added the Duplicate An existing issue was already created label Jun 5, 2023
@Andarist
Copy link
Contributor

Andarist commented Jun 6, 2023

This is intended, see: #52387

@guillaumebrunerie
Copy link

Note that it still works fine if you use (...args: never[]) => void instead (and it makes a bit more sense, because rest arguments are supposed to have an array/tuple type).

@typescript-bot
Copy link
Collaborator

This issue has been marked as 'Duplicate' and has seen no recent activity. It has been automatically closed for house-keeping purposes.

@typescript-bot typescript-bot closed this as not planned Won't fix, can't repro, duplicate, stale Jun 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

4 participants