8000 Merge pull request #4716 from Microsoft/optimizeFreshTypeRelation · fleurdeswift/TypeScript@aa434a1 · GitHub
[go: up one dir, main page]

Skip to content

Commit aa434a1

Browse files
committed
Merge pull request microsoft#4716 from Microsoft/optimizeFreshTypeRelation
Only obtain regular type of fresh object literal type if necessary
2 parents c90276f + c05650a commit aa434a1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/compiler/checker.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4640,7 +4640,9 @@ namespace ts {
46404640
// and intersection types are further deconstructed on the target side, we don't want to
46414641
// make the check again (as it might fail for a partial target type). Therefore we obtain
46424642
// the regular source type and proceed with that.
4643-
source = getRegularTypeOfObjectLiteral(source);
4643+
if (target.flags & TypeFlags.UnionOrIntersection) {
4644+
source = getRegularTypeOfObjectLiteral(source);
4645+
}
46444646
}
46454647

46464648
let saveErrorInfo = errorInfo;
@@ -5511,6 +5513,7 @@ namespace ts {
55115513
regularType.constructSignatures = (<ResolvedType>type).constructSignatures;
55125514
regularType.stringIndexType = (<ResolvedType>type).stringIndexType;
55135515
regularType.numberIndexType = (<ResolvedType>type).numberIndexType;
5516+
(<FreshObjectLiteralType>type).regularType = regularType;
55145517
}
55155518
return regularType;
55165519
}

0 commit comments

Comments
 (0)
0