Skip to content

Commit 67d8598

Browse files
committed
Types with identical object identities are always related
1 parent 2234d07 commit 67d8598

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/compiler/checker.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20609,6 +20609,8 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
2060920609
* * Ternary.False if they are not related.
2061020610
*/
2061120611
function isRelatedTo(originalSource: Type, originalTarget: Type, recursionFlags: RecursionFlags = RecursionFlags.Both, reportErrors = false, headMessage?: DiagnosticMessage, intersectionState = IntersectionState.None): Ternary {
20612+
if (originalSource === originalTarget) return Ternary.True;
20613+
2061220614
// Before normalization: if `source` is type an object type, and `target` is primitive,
2061320615
// skip all the checks we don't need and just return `isSimpleTypeRelatedTo` result
2061420616
if (originalSource.flags & TypeFlags.Object && originalTarget.flags & TypeFlags.Primitive) {

0 commit comments

Comments
 (0)