Types Generation
BlazeKit automatically generates TypeScript interfaces for each model in your schema, allowing you to work with strong typing and reducing boilerplate code. These types are created based on your schema definition and can be found in the directory you specify in the typesOutputDir
configuration inside your .blazerc
file.
What BlazeKit Generates
For each model defined in your schema, BlazeKit generates:
- TypeScript Interface — An interface for the model, using TypeScript’s syntax, which can be imported and used throughout your project.
Example Output
Suppose you have a schema model User
in your schema.blaze
file like this:
model User {
name: string
age: number
}
BlazeKit will automatically generate the following type for User
:
// User.ts (auto-generated)
export interface User {
name: string;
age: number;
}
How It Works
The types for each model are generated based on the schema you provide. The names of the generated files match the names of the models, and the contents of these files contain TypeScript interfaces that mirror the structure of your models.
The output directory for the types is specified in your .blazerc
file under the typesOutputDir
field. By default, this points to thesrc/types
folder.
Notes
- The generated TypeScript interfaces are automatically placed in the directory specified by the
typesOutputDir
field in your.blazerc
file. - The file names of the generated types match the model names in the schema (e.g.,
User
→User.ts
). - The generated types are simple interfaces, reflecting the model definitions you provide, and can be easily used throughout your app to ensure strong typing.