2 Object.defineProperty(exports, "__esModule", { value: true });
3 exports.typeErrorParams = exports.typeErrorMessage = exports.typeError = void 0;
4 const codegen_1 = require("../../compile/codegen");
5 function typeError(t) {
7 message: (cxt) => typeErrorMessage(cxt, t),
8 params: (cxt) => typeErrorParams(cxt, t),
11 exports.typeError = typeError;
12 function typeErrorMessage({ parentSchema }, t) {
13 return (parentSchema === null || parentSchema === void 0 ? void 0 : parentSchema.nullable) ? `must be ${t} or null` : `must be ${t}`;
15 exports.typeErrorMessage = typeErrorMessage;
16 function typeErrorParams({ parentSchema }, t) {
17 return (0, codegen_1._) `{type: ${t}, nullable: ${!!(parentSchema === null || parentSchema === void 0 ? void 0 : parentSchema.nullable)}}`;
19 exports.typeErrorParams = typeErrorParams;
20 //# sourceMappingURL=error.js.map