types-testing
Version:
Test TypeScript types at test runner runtime - Works seamlessly with Jest, Vitest, and Bun.
34 lines (33 loc) • 1.03 kB
JavaScript
import { Factory } from "../index.js";
const toExtends = Factory.assertionWithTypeArgument(
(checker, received, expected) => {
return checker.isTypeAssignableTo(received, expected);
}
);
const toAssignable = toExtends;
const toCompatible = toExtends;
const toExtendsMutually = Factory.assertionWithTypeArgument(
(checker, received, expected) => {
return checker.isTypeAssignableTo(received, expected) && checker.isTypeAssignableTo(expected, received);
}
);
const toAssignableMutually = toExtendsMutually;
const toMutual = toExtendsMutually;
const toExtendsEitherWay = Factory.assertionWithTypeArgument(
(checker, received, expected) => {
return checker.isTypeAssignableTo(received, expected) || checker.isTypeAssignableTo(expected, received);
}
);
const toAssignableEitherWay = toExtendsEitherWay;
const toRelate = toExtendsEitherWay;
export {
toAssignable,
toAssignableEitherWay,
toAssignableMutually,
toCompatible,
toExtends,
toExtendsEitherWay,
toExtendsMutually,
toMutual,
toRelate
};