From 59cc377899246081e50f076d9396a184aba45f61 Mon Sep 17 00:00:00 2001 From: abearxiong Date: Fri, 16 Jan 2026 22:34:12 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E7=BB=93=E6=9E=84=EF=BC=8C=E6=B7=BB=E5=8A=A0=20.gitignore?= =?UTF-8?q?=E3=80=81package.json=E3=80=81pnpm-lock.yaml=20=E5=92=8C=20src/?= =?UTF-8?q?index.ts=20=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 43 +++++++++++++++++++++++++++++++++++++++++++ package.json | 17 +++++++++++++++++ pnpm-lock.yaml | 22 ++++++++++++++++++++++ src/index.ts | 7 +++++++ 4 files changed, 89 insertions(+) create mode 100644 .gitignore create mode 100644 package.json create mode 100644 pnpm-lock.yaml create mode 100644 src/index.ts diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..66cf2c3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,43 @@ +# Dependencies +node_modules/ +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* + +# Testing +coverage/ +*.lcov + +# Production +dist/ +build/ +out/ + +# Misc +.DS_Store +*.pem + +# Debug +*.log +logs/ + +# Editor +.vscode/ +.idea/ +*.swp +*.swo +*~ + +# TypeScript +*.tsbuildinfo + +# Environment variables +.env +.env.local +.env.*.local + +# Temporary files +*.tmp +.cache/ diff --git a/package.json b/package.json new file mode 100644 index 0000000..393bd40 --- /dev/null +++ b/package.json @@ -0,0 +1,17 @@ +{ + "name": "test-zod", + "version": "0.0.1", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [], + "author": "abearxiong (https://www.xiongxiao.me)", + "license": "MIT", + "packageManager": "pnpm@10.14.0", + "type": "module", + "dependencies": { + "zod": "^4.3.5" + } +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml new file mode 100644 index 0000000..007e842 --- /dev/null +++ b/pnpm-lock.yaml @@ -0,0 +1,22 @@ +lockfileVersion: '9.0' + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + +importers: + + .: + dependencies: + zod: + specifier: ^4.3.5 + version: 4.3.5 + +packages: + + zod@4.3.5: + resolution: {integrity: sha512-k7Nwx6vuWx1IJ9Bjuf4Zt1PEllcwe7cls3VNzm4CQ1/hgtFUK2bRNG3rvnpPUhFjmqJKAKtjV576KnUkHocg/g==} + +snapshots: + + zod@4.3.5: {} diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..d3f615c --- /dev/null +++ b/src/index.ts @@ -0,0 +1,7 @@ +import { z } from 'zod' + +const name = z.string().optional().describe('The name of the user') +// name.optional() +// console.log(name.description) // Output: The name of the user + +console.log(JSON.stringify(name), name.description) // Output: The name of the user \ No newline at end of file