-
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
Contextual type of methods only in noImplicitAny or JS #50542
base: main
Are you sure you want to change the base?
Conversation
@typescript-bot run dt |
Heya @sandersn, I've started to run the diff-based user code test suite on this PR at 04c2fbd. You can monitor the build here. Update: The results are in! |
@typescript-bot test this |
User tests show a difference only in webpack, which uses checkJS -- there are two new errors where a parameter now inherits the base type but assumes a derived type. And there are many removed noImplicitAny errors. The RWC diff is empty. I hope that means there are no diffs. But I don't know how many RWC projects have noImplicitAny turned on. |
@@ -9134,6 +9134,26 @@ namespace ts { | |||
if (type) { | |||
return addOptionality(type, /*isProperty*/ false, isOptional); | |||
} | |||
if (isMethodDeclaration(func) && isClassLike(func.parent) | |||
&& (noImplicitAny || isInJSFile(func.parent))) { // TODO: Might want to fiddle with restrictions here |
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.
out of curiosity - what's the reasoning to only apply this logic with noImplicitAny
(and in JS files)? 🤔
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.
- noImplicitAny: untyped parameters will get an error at the same time they get
any
, so this change can't cause code with 0 errors to compile with >0 errors. - JS files: in JS, errors aren't reported anyway, so any improvement in typing should show up as improvement in completions. (this might need to change to exclude checkjs)
@typescript-bot pack this |
Heya @RyanCavanaugh, I've started to run the tarball bundle task on this PR at 04c2fbd. You can monitor the build here. |
@typescript-bot test top100 |
Heya @sandersn, I've started to run the diff-based user code test suite on this PR at 04c2fbd. You can monitor the build here. Update: The results are in! |
@sandersn Here are the results of running the top-repos suite comparing Everything looks good! |
This would be fantastic. Hope it gets merged! |
Fixes #23911, maybe