-
Notifications
You must be signed in to change notification settings - Fork 97
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
fix: don't allow additional parameters #2491
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks very much for this DX enhancement @andipaetzold 🙇
I agree with you in your assessment that although the change tightens type restrictions, it is unlikely to break existing code unless that code relies on passing unintended parameters, so I also see this as more of a bug fix than a breaking change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I absolutely think type changes should be handled like code changes but in this case I think it's fine and can be considered a fix 🙂
@@ -9,7 +9,8 @@ | |||
"isolatedModules": true, | |||
"esModuleInterop": true, | |||
"noImplicitThis": false, | |||
"typeRoots": ["node_modules/@types"] | |||
"typeRoots": ["node_modules/@types"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a question but isn't this the default?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, afaik, it is. This line can probably be removed.
🎉 This PR is included in version 11.40.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Summary
Have stricter types and forbid passing additional params
Description
Currently, the following code is valid:
We allow passing additional params and loose type-safety that way. The goal with this PR is to improve type-safety and DX by having stricter types and forbidding passing additional params.
With this change, the developer will receive an error:
As we are touching types, you can consider this a breaking change. However, argued that way, every change is breaking.
To test this change, I introduced vitest typechecking tests.
To make typescript happy,
skipLibCheck
had to be enabled. But, IMO, that's anyway recommended to be enabled. This should speed-up general type checking as well.Checklist (check all before merging)