ts-to-zod:从打字稿类型界面生成zod模式

时间:2021-04-01 16:07:31
【文件属性】:
文件名称:ts-to-zod:从打字稿类型界面生成zod模式
文件大小:219KB
文件格式:ZIP
更新时间:2021-04-01 16:07:31
TypeScript ts到zod 从Typescript类型/接口生成模式(v3)。 用法 $ yarn add --dev ts-to-zod $ yarn ts-to-zod src/iDontTrustThisApi.ts src/nowIcanValidateEverything.ts 就是这样,转到src/nowIcanValidateEverything.ts文件,您应该具有所有导出的interface并使用以下名称模式作为Zod架构type : ${originalType}Schema 。 注意:生成的zod模式具有zod@next作为依赖项。 生成的集成测试 要确保生成的zod模式与原始类型100%兼容,可以添加--tests src/integrationTests.ts标志以生成一个额外的文件。 请确保此文件是您的打字稿项目的一部分,如果所有内容均为绿色,则表示一切正常,否则,请
【文件预览】:
ts-to-zod-main
----tsconfig.package.json(68B)
----.github()
--------PULL_REQUEST_TEMPLATE.md(70B)
--------ISSUE_TEMPLATE()
--------workflows()
----yarn.lock(213KB)
----.eslintrc.js(420B)
----src()
--------config.ts(535B)
--------utils()
--------index.ts(398B)
--------core()
--------cli.ts(7KB)
--------config.d.ts(643B)
----example()
--------heros.ts(539B)
--------heros.zod.ts(629B)
--------heros.integration.ts(834B)
--------README.md(526B)
----tsconfig.json(466B)
----LICENSE(1KB)
----README.md(6KB)
----.husky()
--------pre-commit(81B)
--------.gitignore(2B)
----ts-to-zod-logo.svg(149KB)
----.gitignore(81B)
----bin()
--------run(327B)
--------run.cmd(31B)
----package.json(2KB)

网友评论