Urara-Blog/node_modules/.pnpm-store/v3/files/17/c6de80bc132fbd2ff4c5e9dc1c880c69a01e4d914bb36baf7443fe2aa59781f378bf8627b3b2dcc0e30aa2f7045d6232b5d644126cec47b2366f500817ea85
2022-08-14 01:14:53 +08:00

20 lines
No EOL
893 B
Text

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.typeErrorParams = exports.typeErrorMessage = exports.typeError = void 0;
const codegen_1 = require("../../compile/codegen");
function typeError(t) {
return {
message: (cxt) => typeErrorMessage(cxt, t),
params: (cxt) => typeErrorParams(cxt, t),
};
}
exports.typeError = typeError;
function typeErrorMessage({ parentSchema }, t) {
return (parentSchema === null || parentSchema === void 0 ? void 0 : parentSchema.nullable) ? `must be ${t} or null` : `must be ${t}`;
}
exports.typeErrorMessage = typeErrorMessage;
function typeErrorParams({ parentSchema }, t) {
return (0, codegen_1._) `{type: ${t}, nullable: ${!!(parentSchema === null || parentSchema === void 0 ? void 0 : parentSchema.nullable)}}`;
}
exports.typeErrorParams = typeErrorParams;
//# sourceMappingURL=error.js.map