Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
Andarist committed Mar 18, 2024
1 parent 3db7f77 commit d142aae
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25446,7 +25446,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
arraysEqual((source as TemplateLiteralType).texts, target.texts) ? map((source as TemplateLiteralType).types, (s, i) => {
return isTypeAssignableTo(getBaseConstraintOrType(s), getBaseConstraintOrType(target.types[i])) ? s : getStringLikeTypeForType(s);
}) :
inferFromLiteralPartsToTemplateLiteral((source as TemplateLiteralType).texts, (source as TemplateLiteralType).types, target) :
inferFromLiteralPartsToTemplateLiteral((source as TemplateLiteralType).texts, (source as TemplateLiteralType).types, target) :
undefined;
}

Expand Down Expand Up @@ -26060,16 +26060,6 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
// allowed template literal placeholder types, infer from a literal type corresponding to the constraint.
if (source.flags & TypeFlags.StringLiteral && target.flags & TypeFlags.TypeVariable) {
const inferenceContext = getInferenceInfoForType(target);
// andarist here???
// declare function foo1<V extends string>(arg: `*${V}*`): V;
// declare const n: number
// let x5 = foo1(`*${n}*` as const);

// type Foo1<T> = T extends `*${infer U}*` ? U : never;

// type T05 = Foo1<`*${number}*`>;

// type T06 = Foo1<`*${bigint}*`>;
const constraint = inferenceContext ? getBaseConstraintOfType(inferenceContext.typeParameter) : undefined;
if (constraint && !isTypeAny(constraint)) {
const constraintTypes = constraint.flags & TypeFlags.Union ? (constraint as UnionType).types : [constraint];
Expand Down

0 comments on commit d142aae

Please sign in to comment.