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)?
Fixes #23911, maybe