-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Use function that doesn't return unknown type #54713
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
@typescript-bot test this |
Heya @gabritto, I've started to run the diff-based user code test suite on this PR at eba78e4. You can monitor the build here. Update: The results are in! |
Heya @gabritto, I've started to run the perf test suite on this PR at eba78e4. You can monitor the build here. Update: The results are in! |
Heya @gabritto, I've started to run the parallelized Definitely Typed test suite on this PR at eba78e4. You can monitor the build here. Update: The results are in! |
Heya @gabritto, I've started to run the diff-based top-repos suite on this PR at eba78e4. You can monitor the build here. Update: The results are in! |
@gabritto Here are the results of running the user test suite comparing There were infrastructure failures potentially unrelated to your change:
Otherwise... Something interesting changed - please have a look. Details
|
@gabritto Here they are:
CompilerComparison Report - main..54713
System
Hosts
Scenarios
TSServerComparison Report - main..54713
System
Hosts
Scenarios
StartupComparison Report - main..54713
System
Hosts
Scenarios
Developer Information: |
@gabritto Here are the results of running the top-repos suite comparing Everything looks good! |
Hey @gabritto, the results of running the DT tests are ready. Main only errors:Package: qrcode
|
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.
Looks good although I'd recommend moving the new function next to the existing one.
src/compiler/checker.ts
Outdated
@@ -22721,6 +22718,13 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { | |||
} | |||
const filtered = contains(include, Ternary.False) ? getUnionType(types.filter((_, i) => include[i])) : target; | |||
return filtered.flags & TypeFlags.Never ? target : filtered; | |||
|
|||
function getTypeOfPropertyOrIndexSignatureOfType(type: Type, name: __String): Type | undefined { |
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.
It might be less confusing to have this next to getTypeOfPropertyOrIndexSignatureOfType.
Well, initially more confusing for the reader, because they'll have to ask "Why are there two here?". But they'll be aware that there are two nearly identical things that need to be used in different situations.
When refactoring #54596, I introduced a bug by using a function that returns
unknownType
when a property or index signature is missing. Instead, we need to use a function that returnsundefined
when the property or index signature is missing.Fixes the failing package
qrcode
on the nightly DT run (https://typescript.visualstudio.com/TypeScript/_build/results?buildId=155426&view=logs&j=71179031-6417-5a2f-3d87-af6fce2011e4&t=69c46c41-df19-593d-5ed2-0b9c514993a3).