Skip to content

Allow weak type detection for intersection sources - #26668

Merged
Nathan Shively-Sanders (sandersn) merged 1 commit into
masterfrom
weak-type-detection-for-intersection-sources
Aug 24, 2018
Merged

Nathan Shively-Sanders (sandersn) merged 1 commit into
masterfrom
weak-type-detection-for-intersection-sources

Conversation

@sandersn

Copy link
Copy Markdown
Member

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>.

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

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>`.
@RyanCavanaugh

Copy link
Copy Markdown
Member

Please fix the errors on DT once this merges

@sandersn
Nathan Shively-Sanders (sandersn) deleted the weak-type-detection-for-intersection-sources branch August 24, 2018 17:31
@sandersn

Copy link
Copy Markdown
Member Author

OK, here's the PR for the Definitely Typed breaks: DefinitelyTyped/DefinitelyTyped#28366

@microsoft Microsoft (microsoft) locked as resolved and limited conversation to collaborators Oct 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants