forgot to add new function to index.d.ts

This commit is contained in:
Joeri Exelmans 2025-05-16 13:04:06 +02:00
parent 106bd0bfdb
commit 8446f9ba9e
2 changed files with 6 additions and 3 deletions

2
index.d.ts vendored
View file

@ -177,6 +177,8 @@ export function apply(input: any): any;
export function assignFn(funType: any, paramType: any): any;
export function assignFnSubstitutions(funType: any, paramType: any): [any, any];
export function capitalizeFirstLetter(val: any): any;
export function compareBools(x: any): any;

View file

@ -187,8 +187,8 @@ export const substitute = (type, substitutions, stack=[]) => {
};
export const assignFn = (funType, paramType) => {
const [result] = assignFnSubstitutions(funType, paramType);
return result;
const [outType] = assignFnSubstitutions(funType, paramType);
return outType;
};
// same as above, but also returns the substitutions that took place
@ -202,7 +202,8 @@ export const assignFnSubstitutions = (funType, paramType) => {
const {substitutions} = __unify(inType, paramType);
// console.log(substitutions, prettyT(outType));
const substitutedFnType = substitute(outType, substitutions);
return [recomputeTypeVars([substitutedFnType])[0], substitutions];
const computedOutType = recomputeTypeVars([substitutedFnType])[0];
return [computedOutType, substitutions];
}
// Ensures that no type variables overlap