The way I would suggest doing this is to pull out the wordType field as a separate schema which you would then use within the z.object. Like:

const wordTypeSchema = z.enum(["verb", "adjective", "noun"]);
type WordType = z.infer<typeof wordTypeSchema>;
export const wordAPI = z.object({
  words: z.array(
    z.object({
      id: z.string(),
      word: z.string(),
      translation: z.string(),
      type: wordTypeSchema
    })
  )
});

and then I would just use the WordType type wherever else I needed just that value.

It is, however, possible to extract the type from your nested object like so:

type WordAPI = z.infer<typeof wordAPI>;
type WordType = WordAPI['words'][number]['type'];
//    ^- This will include `| null` because you used `.nullable`
// If you don't want the | null you would need to say
type WordTypeNotNull = Exclude<WordType, null>;

Again, I would recommend the first approach as it's more reusable and less susceptible to needing to be updated if the object changes shape for example.

Answer from Souperman on Stack Overflow
🌐
Zod
zod.dev › basics
Basic usage | Zod
const Player = z.object({ username: z.string(), xp: z.number() }); // extract the inferred type type Player = z.infer<typeof Player>; // use it in your code const player: Player = { username: "billie", xp: 100 };
🌐
GitHub
github.com › colinhacks › zod
GitHub - colinhacks/zod: TypeScript-first schema validation with static type inference · GitHub
TypeScript-first schema validation with static type inference by @colinhacks ... Zod is a TypeScript-first validation library. Define a schema and parse some data with it.
Author   colinhacks
Discussions

Question about zod inferred types
Come, son of Jor-El! Kneel before Zod! More on reddit.com
🌐 r/typescript
19
4
July 26, 2023
typescript - Infer type from key of object inside an array Zod - Stack Overflow
So I'd like to grab the type from a key of an object within an array in Zod. That array is also nested within an object, just to make things extra difficult. This is an abstract view of the problem... More on stackoverflow.com
🌐 stackoverflow.com
Using "zod.infer" in a specific object will cause the vs code typescript intellisense stuck forever in "Loading..."
Hello gyes! I'm new using zod as validator for objects. I have found a very frustrating bug! When I use zod infer to create a new type of object based on a zod object my visual studio code inte... More on github.com
🌐 github.com
14
February 12, 2024
typescript - How to infer type from a schema generated by a generic function in zod? - Stack Overflow
I got it working by using with ZodType instead of with . Almost works as intended, as undefined will be return beside number in the getLeafValue function. type Leaf = z.infer>>> type NumberLeaf = Leaf // ^? ... More on stackoverflow.com
🌐 stackoverflow.com
🌐
Zod
zod.dev
Intro | Zod
Introduction to Zod - TypeScript-first schema validation library with static type inference
🌐
Zod
zod.dev › api
Defining schemas | Zod
Zod aims to mirror TypeScript's type system one-to-one. As such, Zod provides APIs to represent the following special types: // allows any values z.any(); // inferred type: `any` z.unknown(); // inferred type: `unknown`
🌐
Reddit
reddit.com › r/typescript › question about zod inferred types
r/typescript on Reddit: Question about zod inferred types
July 26, 2023 -

Currently checking the possibility of using zod library to perform schema validation.

So far it seems very interesting, however one thing is worrying me. Apart from schema validation, I would also like to automatically infer types from the zod schemas and export those same types for other projects to use.

My worry is that the inferred types from the zod schemas are not the equivalent Typescript types but actually zod generated types.

It seems to me that we can use those zod inferred types in the same way as the Typescript type equivalents (accessing properties directly, etc).

However, could exporting these types to other projects create issues that I'm not foreseeing (static type checks not working properly for example)? Also, is it considered a good practice to export those zod inferred types? Ideally we would like to generate Typescript types from zod schemas with zod, without using other external library, is there a way to do it? In this specific scenario, where we need to have schemas and infer types from it and export those to other projects, would you recommend a different library or approach for that?

🌐
DEV Community
dev.to › safal_bhandari › zod-inference-2m86
Zod Inference - DEV Community
October 1, 2025 - Zod is a TypeScript-first schema declaration and validation library. You define schemas that validate data at runtime, while also inferring TypeScript types automatically.
Find elsewhere
🌐
npm
npmjs.com › package › zod
zod - npm
May 4, 2026 - TypeScript-first schema declaration and validation library with static type inference. Latest version: 4.4.3, last published: 3 months ago. Start using zod in your project by running `npm i zod`. There are 111493 other projects in the npm registry using zod.
      » npm install zod
    
Published   May 04, 2026
Version   4.4.3
🌐
LogRocket
blog.logrocket.com › home › schema validation in typescript with zod
Schema validation in TypeScript with Zod - LogRocket Blog
July 30, 2024 - Zod emphasizes the DRY principle and makes sure that schema defined in one place can be tokenized and used for other types as well, either by inferring those types or extending them.
🌐
Total TypeScript
totaltypescript.com › tutorials › zod › zod-section › infer › solution
Use z.infer() to Extract a Type | Total TypeScript
June 7, 2023 - ... Matt Pocock: 0:00 The way to do it is with z.infer. What you do with z.infer is you pass in the typeof StarWarsPeopleResults here. This is passing in the schema that you get from Zod.
🌐
GitHub
github.com › colinhacks › zod › issues › 3233
Using "zod.infer" in a specific object will cause the vs code typescript intellisense stuck forever in "Loading..." · Issue #3233 · colinhacks/zod
February 12, 2024 - If we uncomment z.infer line the intellisense will stop working in entire project: I created a repo where we can reproduce the error with the vs code intellisense. Basically to initialize the repo you should execute "npm install" and "npx prisma generate" to generate the schemas and objects from prisma database. Repo: https://github.com/ADSNB/intellisense-bug-zod-infer
Author   colinhacks
🌐
Didoesdigital
didoesdigital.com › blog › zod-type-parsing-functions
Zod Type Parsing Functions · DiDoesDigital
March 1, 2025 - The .array() method returns a new ZodArray instance. Therefore, the order matters: z.string().optional().array(); // (string | undefined)[] z.string().array().optional(); // string[] | undefined · The array parsing function has some validation methods: ... z.string().array().nonempty(); // inferred type: [string, ...string[]] z.string().array().min(1); // inferred type: string[]
🌐
GitHub
v3.zod.dev
Zod | Documentation
Zod is designed to be as developer-friendly as possible. The goal is to eliminate duplicative type declarations. With Zod, you declare a validator once and Zod will automatically infer the static TypeScript type.
🌐
Steve Kinney
stevekinney.com › courses › full stack typescript › advanced schema design with zod
Advanced Schema Design with Zod | Full Stack TypeScript | Steve Kinney
Zod’s powerful type inference capabilities are a game-changer for TypeScript developers. The z.infer<typeof schema> utility allows you to automatically extract the TypeScript type from a Zod schema.
🌐
JSR
jsr.io › @zod › zod › doc › v4 › core › ~ › infer
infer from v4/core - @zod/zod - JSR.io
May 8, 2026 - @zod/zod on JSR: TypeScript-first schema declaration and validation library with static type inference
🌐
Allthingstypescript
allthingstypescript.dev › all things typescript › using zod schemas as a source of truth for typescript types
Using Zod Schemas as a Source of Truth for Typescript Types
June 18, 2025 - Learn how to avoid duplicating both Zod Schemas and Typescript Types and instead infer Types from Zod Schemas, using them as a source of truth for your Types.
🌐
Medium
medium.com › @thiwankajayasiri › typescript-has-become-an-industry-standard-for-writing-robust-javascript-applications-83e3744a050e
“ZOD” ; TypeScript-first schema validation with static type inference | by Thiwanka Chameera Jayasiri | Medium
August 11, 2023 - “ZOD” ; TypeScript-first schema validation with static type inference TypeScript has become an industry standard for writing robust JavaScript applications. Type safety allows developers to catch …