Skip to content

langium-zod / ZodTypeDescriptor

Type Alias: ZodTypeDescriptor

ts
type ZodTypeDescriptor = 
  | ZodObjectTypeDescriptor
  | ZodUnionTypeDescriptor
  | ZodPrimitiveAliasDescriptor
  | ZodKeywordEnumDescriptor
  | ZodRegexEnumDescriptor;

Defined in: types.ts:127

Union of all type descriptor shapes that the extractor can produce and the code generator can consume. Each variant carries a discriminating kind field: 'object', 'union', 'primitive-alias', 'keyword-enum', or 'regex-enum'.

Remarks

Use the kind discriminator to narrow to a specific variant before accessing variant-specific fields:

ts
if (descriptor.kind === 'object') {
  // descriptor is ZodObjectTypeDescriptor
  descriptor.properties; // available
}

See

Released under the MIT License.