Repository navigation
Allow weak type detection for intersection sources - #26668
Merged
Nathan Shively-Sanders (sandersn) merged 1 commit intoAug 24, 2018
Merged
Nathan Shively-Sanders (sandersn) merged 1 commit into
Nathan Shively-Sanders (sandersn) merged 1 commit into
Conversation
Previously, intersections were only allowed as targets, but this was
just an artifact of the original implementation, which operated inside
the structural part of isRelatedTo. Removing this restriction catches
subtle bugs in React user code, where a function named `create` returns
a mapped type whose types are all branded numbers. The display of these
properties, for some original type `T`, is not `number & { __ }` but
the much-less-obvious `RegisteredStyle<T>`.
Nathan Shively-Sanders (sandersn)
requested review from
Ryan Cavanaugh (RyanCavanaugh) and
Wesley Wigham (weswigham)
August 24, 2018 15:56
Member
|
Please fix the errors on DT once this merges |
Ryan Cavanaugh (RyanCavanaugh)
approved these changes
Aug 24, 2018
Nathan Shively-Sanders (sandersn)
deleted the
weak-type-detection-for-intersection-sources
branch
August 24, 2018 17:31
Member
Author
|
OK, here's the PR for the Definitely Typed breaks: DefinitelyTyped/DefinitelyTyped#28366 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously, intersections were only allowed as targets, but this was just an artifact of the original implementation, which operated inside the structural part of isRelatedTo. Removing this restriction catches subtle bugs in React user code, where a function named
createreturns a mapped type whose types are all branded numbers. The display of these properties, for some original typeT, is notnumber & { __ }but the much-less-obviousRegisteredStyle<T>.I didn't see any new errors on the user tests, and on Definitely Typed, only in react-native-sortable-list and react-native-swiper, which is where I found the branded number example.
Fixes #19296