File tree 1 file changed +10
-8
lines changed
1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -17928,14 +17928,6 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
17928
17928
}
17929
17929
17930
17930
function getTemplateLiteralType(texts: readonly string[], types: readonly Type[]): Type {
17931
- if (texts.length === 2 && texts[0] === "" && texts[1] === ""
17932
- // literals (including string enums) are stringified below
17933
- && !(types[0].flags & TypeFlags.Literal)
17934
- // infer T extends StringLike can't be unwrapped eagerly
17935
- && !types[0].symbol?.declarations?.some(d => d.parent.kind === SyntaxKind.InferType)
17936
- && isTypeAssignableTo(types[0], stringType)) {
17937
- return types[0];
17938
- }
17939
17931
const unionIndex = findIndex(types, t => !!(t.flags & (TypeFlags.Never | TypeFlags.Union)));
17940
17932
if (unionIndex >= 0) {
17941
17933
return checkCrossProductUnion(types) ?
@@ -17945,6 +17937,16 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
17945
17937
if (contains(types, wildcardType)) {
17946
17938
return wildcardType;
17947
17939
}
17940
+ if (
17941
+ texts.length === 2 && texts[0] === "" && texts[1] === ""
17942
+ // literals (including string enums) are stringified below
17943
+ && !(types[0].flags & TypeFlags.Literal)
17944
+ // infer T extends StringLike can't be unwrapped eagerly
17945
+ && !types[0].symbol?.declarations?.some(d => d.parent.kind === SyntaxKind.InferType)
17946
+ && isTypeAssignableTo(types[0], stringType)
17947
+ ) {
17948
+ return types[0];
17949
+ }
17948
17950
const newTypes: Type[] = [];
17949
17951
const newTexts: string[] = [];
17950
17952
let text = texts[0];
You can’t perform that action at this time.
0 commit comments