Skip to main content
Version: 3.0 Beta

@core/typescript

The @core/typescript plugin generates TypeScript code from ZModel. The generated code is used to access the schema at runtime, as well as type declarations at development time.

Note: This plugin runs automatically when you execute zenstack generate, even if not explicitly declared in your schema. You only need to declare it if you want to customize its options.

Options​

  • output: Specifies the output directory for the generated TypeScript code. If a relative path is provided, it will be resolved relative to the ZModel schema.

Output​

The plugin generates the following TypeScript files:

  • schema.ts: TypeScript object representation of the ZModel schema.
  • models.ts: Exports types for all models, types, and enums defined in the schema.
  • input.ts: Exports types that you can use to type the arguments passed to the ORM query API, such as findMany, create, etc.

Example​

plugin ts {
provider = '@core/typescript'
output = '../generated'
}
Comments
Feel free to ask questions, give feedback, or report issues.

Don't Spam


You can edit/delete your comments by going directly to the discussion, clicking on the 'comments' link below