Generating Typescript Models

Dear Forest-Team,

we are in the process of migrating our agent from sequelize to the agent. The documentation of the agent talks about the typing file generated by forest admin, but we don’t have that in our project. The documentation das not say how to trigger any logic.

We are on forest-express-sequelize 9 and @forestadmin/agent 1.44.

Is there any way to autogenerate type definitions for our models like forest schema:update created our JS files?

Thank you!
Markus

Hello @marksrr !

When using @forestadmin/agent, you have to specify where to generate the type definitions for your models by using the typingsPath option when creating your agent with createAgent. Here’s an example:

createAgent({
  // ...others setup options
  typingsPath: './typings.ts',
  typingsMaxDepth: 5,
})

In this example, when you start your application, after the initial analysis of your database schemas by the agent, the type definitions will be generated in the ./typings.ts file of your project.

For more details on the available options, feel free to check the official documentation.

1 Like

Ah ok I think I misunderstood that property, thank you!