Skip to content

Commit eb13a1d

Browse files
committed
Readme: emphasising env prop article, add known caveat article.
1 parent 5f4258c commit eb13a1d

1 file changed

Lines changed: 20 additions & 1 deletion

File tree

README.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ Start your API server with I/O schema validation and custom middlewares in minut
5858
5. [Graceful shutdown](#graceful-shutdown)
5959
6. [Subscriptions](#subscriptions)
6060
8. [Caveats](#caveats)
61-
1. [Excessive properties in endpoint output](#excessive-properties-in-endpoint-output)
61+
1. [Zod 4 schema assignment error](#zod-4-schema-assignment-error)
62+
2. [Excessive properties in endpoint output](#excessive-properties-in-endpoint-output)
6263
9. [Your input to my output](#your-input-to-my-output)
6364

6465
See also [Changelog](CHANGELOG.md) and [automated migration](https://www.npmjs.com/package/@express-zod-api/migration).
@@ -176,6 +177,10 @@ pnpm add express-zod-api express zod typescript http-errors
176177
pnpm add -D @types/express @types/node @types/http-errors
177178
```
178179

180+
## Environment preparation
181+
182+
Consider using the recommended `tsconfig.json` base for your project according to your Node.js version,
183+
for example [the base for Node.js 20+](https://github.com/tsconfig/bases/blob/main/bases/node20.json).
179184
Ensure having the following options in your `tsconfig.json` file in order to make it work as expected:
180185

181186
```json
@@ -187,6 +192,8 @@ Ensure having the following options in your `tsconfig.json` file in order to mak
187192
}
188193
```
189194

195+
See also how `moduleResoultion` may cause [Zod 4 schema assignment error](#zod-4-schema-assignment-error);
196+
190197
## Set up config
191198

192199
Create a minimal configuration. Find out all configurable options
@@ -1378,6 +1385,18 @@ framework, [Zod Sockets](https://github.com/RobinTail/zod-sockets), which has si
13781385
There are some well-known issues and limitations, or third party bugs that cannot be fixed in the usual way, but you
13791386
should be aware of them.
13801387

1388+
## Zod 4 schema assignment error
1389+
1390+
When using `zod@^4` and doing `import { z } from "zod/v4"` you may encounter the following error:
1391+
1392+
```text
1393+
TS2739: ZodObject<...> is missing the following properties from ZodType<...>: example, deprecated.
1394+
```
1395+
1396+
In this case make sure the `moduleResolution` in your `tsconfig.json` is either `node16`, `nodenext` or `bundle`.
1397+
Consider the [recommended tsconfig base, Node 20+](https://github.com/tsconfig/bases/blob/main/bases/node20.json).
1398+
Otherwise, keep importing `from "zod/v4"` or consider upgrading the framework to v25.
1399+
13811400
## Excessive properties in endpoint output
13821401

13831402
The schema validator removes excessive properties by default. However, Typescript

0 commit comments

Comments
 (0)