Uh oh!
There was an error while loading. Please reload this page.
Bring typeof switch closer inline with if - #27680
Conversation
| return caseType.flags & TypeFlags.Never ? defaultType : getUnionType([caseType, defaultType]); | ||
| } | ||
| function getTypeFromName(type: Type, text: string) { |
There was a problem hiding this comment.
Would prefer a more descriptive name like getNarrowedTypeByTypeofResult
There was a problem hiding this comment.
Went with getImpliedTypeFromTypeofCase to be consistent with terminology used in the documentation of narrowBySwitchOnTypeOf.
Ryan Cavanaugh (RyanCavanaugh)
commented
Oct 10, 2018
TypeScript Bot (@typescript-bot) test this |
Heya Ryan Cavanaugh (@RyanCavanaugh), I've started to run the extended test suite on this PR at b12ed40. You can monitor the build here. It should now contribute to this PR's status checks. |
- Narrow unknown - Narrow union members (in addition to filtering)
b12ed40 to
b63b40bCompareWesley Wigham (weswigham)
commented
Oct 10, 2018
TypeScript Bot (@typescript-bot) test this but again since it was edited (it passed before, so it should be fine, but just in case~) |
Heya Wesley Wigham (@weswigham), I've started to run the extended test suite on this PR at b63b40b. You can monitor the build here. It should now contribute to this PR's status checks. |
This PR brings
switchnarrowing withtypeofcloser inline withif, which was recently updated in two keys ways:Function, the latterobject | null.Fixes#27180
Fixes#27335
Adds tests for #27181