Beispiel
zod 4.4.3: Identify constructor coercion traps in z.coerce and verify that .refine() discards return values without mutating parsed output
Verifiziertes Beispiel für npm zod 4.4.3: Identify constructor coercion traps in z.coerce and verify that .refine() discards return values without mutating…
sha256:d3a9cc5fa6af1de9c4bd13813f2a670ad60d7afe148dadb0bcc4dc95133a9eb4
Dieses Netzwerk bietet eine Sache: ein Sample, das baut. Es hat es in einer Sandbox ausgeführt und die signierte Quittung behalten. Es bewertet nichts und garantiert nichts — ob derselbe Code bei Ihnen baut, hat es nicht gemessen.
Wie viele verschiedene Signaturschlüssel eine bestandene Vertragsquittung eingereicht haben. Einer ist der Autor allein; mehr als einer heißt, jemand anderes hat es auch gebaut. Ein Schlüssel wird selbst erzeugt und hat keine registrierte Identität dahinter — gezählt werden Schlüssel, nicht Personen.
MIT-0
Ausführungsbelege
Die deklarierte Umgebung und die signierten Läufe stehen getrennt, damit Sie genau sehen, was dieses Sample ausgeführt hat und wo.
- Beleggrundlage
- Signierter Vertrag bestanden
- Verifizierungsbelege
- 2
- Signaturschlüssel, die es gebaut haben
- 2
Deklarierte Umgebung
node linux x64 node node npm
Umgebungen der Verifizierungsläufe
| Umgebung | Contract | Stufen | Lauf |
|---|---|---|---|
| node 22 · linux alpine/x64 · docker ed25519:ac1544ece1e22594 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1 |
2026-08-15 |
| node 22 · linux alpine/x64 · docker ed25519:d91480838ac982c9 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1 |
2026-08-18 |
Fall
HOW- Ziel
- Identify constructor coercion traps in z.coerce and verify that .refine() discards return values without mutating parsed output
- Pakete
- Symbole
-
- z.coerce.boolean
- z.coerce.number
- z.coerce.string
- z.coerce.date
- z.coerce.bigint
- z.ZodType.refine
- Umgebung
- node
- Erstellt
- 2026-08-15T04:21:08Z
Contract
- assert z.coerce.boolean() evaluates Boolean(val), coercing 'false', '0', 'off', 'no', [], and {} to true
- assert z.coerce.boolean() coerces only empty string, 0, null, undefined, and false to false
- assert z.coerce.number() coerces empty string, whitespace, null, false, and [] to 0 rather than failing
- assert z.coerce.number() rejects undefined as invalid_type with received NaN
- assert z.coerce.string() turns null and undefined into literal strings 'null' and 'undefined'
- assert z.coerce.date() coerces null and false to Unix epoch 1970-01-01 but rejects empty string
- assert z.coerce.bigint() coerces empty string and booleans to bigint but rejects null and undefined
- assert refine() discards returned transformed values and preserves raw parsed inputs
- assert chained coercion and refinement coerces empty string and null to 0 before refinement fails with custom issue
Dateien
- NOTES.md
- csx.json
- package-lock.json
- package.json
- src/schema.mjs
- test/contract.mjs