Skip to content

Commit

Permalink
Fix b.zod() (#229)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasavila00 authored May 15, 2024
1 parent 7bd6371 commit 357bdf9
Show file tree
Hide file tree
Showing 10 changed files with 49 additions and 9 deletions.
8 changes: 8 additions & 0 deletions e2e-tests/standalone-parser/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# node-server

## 1.0.49

### Patch Changes

- Updated dependencies
- @beff/client@0.0.52
- @beff/cli@0.0.52

## 1.0.48

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions e2e-tests/standalone-parser/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "standalone-parser",
"version": "1.0.48",
"version": "1.0.49",
"description": "",
"main": "index.js",
"scripts": {
Expand All @@ -11,7 +11,7 @@
"author": "",
"license": "ISC",
"dependencies": {
"@beff/cli": "workspace:^0.0.51",
"@beff/cli": "workspace:^0.0.52",
"@beff/client": "workspace:^",
"vitest": "^0.34.4",
"zod": "^3.23.5"
Expand Down
11 changes: 11 additions & 0 deletions e2e-tests/standalone-parser/tests/b.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,17 @@ it("parse", () => {
"x": 1,
}
`);
expect(
T3.zod().parse({
kind: "square",
x: 1,
})
).toMatchInlineSnapshot(`
{
"kind": "square",
"x": 1,
}
`);
expect(
T3.parse(
{
Expand Down
6 changes: 6 additions & 0 deletions packages/beff-cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @beff/cli

## 0.0.52

### Patch Changes

- fix b.zod

## 0.0.51

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/beff-cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@beff/cli",
"version": "0.0.51",
"version": "0.0.52",
"description": "",
"bin": {
"beff": "./bin/index.js"
Expand Down
8 changes: 8 additions & 0 deletions packages/beff-client/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @beff/client

## 0.0.52

### Patch Changes

- fix b.zod
- Updated dependencies
- @beff/cli@0.0.52

## 0.0.51

### Patch Changes
Expand Down
5 changes: 3 additions & 2 deletions packages/beff-client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@beff/client",
"version": "0.0.51",
"version": "0.0.52",
"description": "",
"main": "dist/cjs/index.js",
"scripts": {
Expand All @@ -20,7 +20,8 @@
"author": "",
"license": "ISC",
"dependencies": {
"@beff/cli": "workspace:^0.0.51"
"@beff/cli": "workspace:^0.0.52",
"zod": "^3.23.5"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^6.7.2",
Expand Down
3 changes: 3 additions & 0 deletions packages/beff-client/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
import type { BeffParser, DecodeError, ParseOptions, RegularDecodeError, UnionDecodeError } from "@beff/cli";
import { z } from "zod";

const prettyPrintValue = (it: unknown): string => {
if (typeof it === "string") {
Expand Down Expand Up @@ -102,6 +103,7 @@ const buildParserFromSafeParser = <T>(
//@ts-ignore
return z.custom(
(data: any) => safeParse(data).success,
//@ts-ignore
(val: any) => {
const errors = (safeParse(val) as any).errors;
//@ts-ignore
Expand All @@ -113,6 +115,7 @@ const buildParserFromSafeParser = <T>(
return {
safeParse,
parse,
//@ts-ignore
zod,
};
};
Expand Down
2 changes: 1 addition & 1 deletion packages/beff-wasm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
},
"devDependencies": {
"@babel/code-frame": "^7.22.13",
"@beff/cli": "workspace:^0.0.51",
"@beff/cli": "workspace:^0.0.52",
"@types/babel__code-frame": "^7.0.4",
"@types/node": "^20.6.2",
"@types/vscode": "^1.73.0",
Expand Down
9 changes: 6 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 357bdf9

Please sign in to comment.