mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-25 05:29:07 -05:00
Allow weak type detection for intersection sources (#26668)
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>`.
This commit is contained in:
committed by
GitHub
parent
bdb7c351a2
commit
0043ba16b1
@@ -11178,7 +11178,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
if (relation !== comparableRelation &&
|
||||
!(source.flags & TypeFlags.UnionOrIntersection) &&
|
||||
!(source.flags & TypeFlags.Union) &&
|
||||
!(target.flags & TypeFlags.Union) &&
|
||||
!isIntersectionConstituent &&
|
||||
source !== globalObjectType &&
|
||||
|
||||
Reference in New Issue
Block a user