File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -22914,10 +22914,15 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
2291422914 }
2291522915
2291622916 if (source.flags & TypeFlags.TemplateLiteral && target.flags & TypeFlags.StringLike) {
22917- (source as TemplateLiteralType).types = (source as TemplateLiteralType).types.flatMap(type => {
22918- return type.flags & TypeFlags.Intersection ? (type as IntersectionType).types.filter(t => t.flags & TypeFlags.Primitive) : [type]
22917+ const resolvedPrimitiveTypes = (source as TemplateLiteralType).types.flatMap(type => {
22918+ if (type.flags & TypeFlags.Intersection && (type as IntersectionType).types.every(type => type.flags & TypeFlags.Primitive || type.flags & TypeFlags.Object)) {
22919+ return (type as IntersectionType).types.filter(t => t.flags & TypeFlags.Primitive)
22920+ } else {
22921+ return [type]
22922+ }
2291922923 });
22920- return isRelatedTo(source, target, RecursionFlags.Both, /*reportErrors*/ false);
22924+
22925+ (source as TemplateLiteralType).types = resolvedPrimitiveTypes;
2292122926 }
2292222927
2292322928 // We limit alias variance probing to only object and conditional types since their alias behavior
You can’t perform that action at this time.
0 commit comments