Commit 2325706
committed
fix(docs): FieldSchema.extend() does not exist — the FAQ recommended a call that throws
#3882 brought content/docs under the example type-check gate and left the open
question: of the blocks still unmarked, is any GENUINE ROT rather than a fragment?
Swept them. One real one.
deployment/troubleshooting.mdx answered "How do I extend a built-in schema?" with
`FieldSchema.extend({ … })`. FieldSchema carries a .transform() that lowers
author-facing sugar at parse time, so it is a ZodPipe, not a ZodObject —
`.extend` is undefined on it (verified against the built package). Anyone
following the FAQ got a "not a function" throw. The example also used `z` without
importing it. Rewritten to FieldSchema.in.extend({ … }) — `.in` is the input
object the pipe wraps — verified to parse, marked so the gate holds it, and it
now says why (same for ObjectSchema/ActionSchema) and warns that the extended
schema no longer runs the transform.
The sweep's METHOD is recorded in the gate docstring, because two traps make a
naive pass report a confident "nothing found":
1. tsc stops after syntactic diagnostics and never runs the semantic pass.
Marking all 780 blocks at once let ~200 broken fragments suppress
type-checking for every other block; that run returned only TS1xxx codes,
which reads exactly like "no rot" and proves nothing. Caught by injecting a
deliberate type error and watching it go unreported.
2. Unimported type names resolve against the DOM lib — Plugin, Event, Response,
Storage all exist there. A block missing its import reports "'version' does
not exist in type 'Plugin'" against lib.dom's Plugin: an artefact, not
drift. Three of the strongest-looking candidates were exactly this.
After both corrections the rest are fragments, plus config-resolution.mdx, whose
aspirational snippets a callout on the page already labels as design intent.
Gate: 196 -> 197 checked examples.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ajwvrmd1hDC9RBofYBhGuR1 parent 93f267f commit 2325706
3 files changed
Lines changed: 81 additions & 3 deletions
File tree
- .changeset
- content/docs/deployment
- packages/spec/scripts
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
359 | 359 | | |
360 | 360 | | |
361 | 361 | | |
362 | | - | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
363 | 367 | | |
| 368 | + | |
364 | 369 | | |
| 370 | + | |
365 | 371 | | |
366 | 372 | | |
367 | | - | |
368 | | - | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
369 | 377 | | |
| 378 | + | |
| 379 | + | |
370 | 380 | | |
371 | 381 | | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
372 | 387 | | |
373 | 388 | | |
374 | 389 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
25 | 45 | | |
26 | 46 | | |
27 | 47 | | |
| |||
0 commit comments