-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build: drop SWC; use TS for cjs/esm bundles #8
Conversation
🦋 Changeset detectedLatest commit: d24f4bb The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
ESM seems to be working import zod from "zod";
import { fromZodError } from "zod-validation-error";
const userSchema = zod.object({
name: zod.string(),
age: zod.number(),
email: zod.string().email(),
});
export function parseUser(value) {
try {
userSchema.parse(value);
} catch (err) {
const validationError = fromZodError(err);
console.log(validationError);
}
}
parseUser({age: 4, email: "test@test.com"}) dnl::src ⌁ node main.mjs
ValidationError: Validation error: Required at "name"
at fromZodError (<project-path>/node_modules/zod-validation-error/dist/cjs/ValidationError.js:27:12)
at parseUser (file://<project-path>/src/main.mjs:14:29)
at file://<project-path>/src/main.mjs:21:1
at ModuleJob.run (node:internal/modules/esm/module_job:193:25)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:530:24)
at async loadESM (node:internal/process/esm_loader:91:5)
at async handleMainPromise (node:internal/modules/run_main:65:12) {
details: [
{
code: 'invalid_type',
expected: 'string',
received: 'undefined',
path: [Array],
message: 'Required'
}
]
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greatness.
@nikoskalogridis can you also afford some time to review this please? |
What changed
exports
keyOther References
Beta link
https://www.npmjs.com/package/zod-validation-error/v/0.2.2-beta.1