generate types from schemas so you never have to type z.infer again
Find a file
2025-11-07 19:56:18 +00:00
.gitignore init 2025-11-05 10:25:15 -08:00
index.ts documenting 2025-11-05 10:36:21 -08:00
package-lock.json init 2025-11-05 10:25:15 -08:00
package.json init 2025-11-05 10:25:15 -08:00
readme.md Update readme.md 2025-11-07 19:56:18 +00:00

zodoinfer

currently it expects Node >= 22.18 and a specific (sveltekit) file structure:

  • src
    • lib
      • types
        • index.ts
        • something.schema.ts
        • generated
          • (generated types go here)

all lines matching the naming pattern "XyzSchema" will generate equivalent type "Xyz"

but you could modify it pretty easily to do what you want

generate types on-save

vscode

  • install "emeraldwalk.RunOnSave" extension
  • add the following to vscode settings.json:
  "emeraldwalk.runonsave": {
      "commands": [
        {
          "match": "\\.schema\\.ts$",
          "isAsync": true,
          "cmd": "node your/path/to/zodoinfer ${file}"
        }
      ]
    }