-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Use missingType instead of undefinedType for optional methods under exactOptionalPropertyTypes
#52519
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
Conversation
…er `exactOptionalPropertyTypes`
|
@typescript-bot test this |
|
Heya @jakebailey, I've started to run the diff-based user code test suite (tsserver) on this PR at f40beb0. You can monitor the build here. Update: The results are in! |
|
Heya @jakebailey, I've started to run the diff-based user code test suite on this PR at f40beb0. You can monitor the build here. Update: The results are in! |
|
Heya @jakebailey, I've started to run the parallelized Definitely Typed test suite on this PR at f40beb0. You can monitor the build here. |
|
Heya @jakebailey, I've started to run the extended test suite on this PR at f40beb0. You can monitor the build here. |
|
Heya @jakebailey, I've started to run the diff-based top-repos suite on this PR at f40beb0. You can monitor the build here. Update: The results are in! |
|
Heya @jakebailey, I've started to run the perf test suite on this PR at f40beb0. You can monitor the build here. Update: The results are in! |
|
Heya @jakebailey, I've started to run the diff-based top-repos suite (tsserver) on this PR at f40beb0. You can monitor the build here. Update: The results are in! |
|
@jakebailey Here are the results of running the user test suite comparing Everything looks good! |
1 similar comment
|
@jakebailey Here are the results of running the user test suite comparing Everything looks good! |
|
Heya @jakebailey, I've run the RWC suite on this PR - assuming you're on the TS core team, you can view the resulting diff here. |
|
@jakebailey Here they are:
CompilerComparison Report - main..52519
System
Hosts
Scenarios
TSServerComparison Report - main..52519
System
Hosts
Scenarios
StartupComparison Report - main..52519
System
Hosts
Scenarios
Developer Information: |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
@jakebailey Here are the results of running the top-repos suite comparing Everything looks good! |
|
@jakebailey Here are the results of running the top-repos suite comparing Something interesting changed - please have a look. Detailspalantir/blueprint
|
| } | ||
| else { | ||
| return strictNullChecks && symbol.flags & SymbolFlags.Optional ? getOptionalType(type) : type; | ||
| return strictNullChecks && symbol.flags & SymbolFlags.Optional ? getOptionalType(type, /*isProperty*/ true) : type; |
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'm honestly really suspicious of every other call to this function now; I went and made isProperty required and about half of the callers are actually working with things that are explicitly property types (and so likely need to also pass true).
No tests change when I make everyone pass in this parameter, though, which makes me think that we don't have enough coverage of this particular option.
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.
This option has a default though - did you try passing true to all calls of this function?
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.
No, I mean I changed it from isProperty = false to isProperty: boolean and then examined all of the places where it error'd.
Not that this is directly required for this PR, just something I noticed.
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.
The missingType thing is only relevant here for with exactOptionalPropertyTypes - and that's not the most popular compiler option. So I definitely wouldn't be surprised if the test suite wouldn't be that comprehensive in this regard.
weswigham
left a comment
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.
As jake says, we might need to audit our other usages of getOptionalType to be more intentional about passing the second parameter; but this does look like the correct fix for this case.
|
I'm going to merge this because it's correct, but, I do think we need to audit the rest and come up with some test cases. |
fixes #52494