How can I properly compile the type of schema?

Hello. I'm currently using Turborepo to manage the monorepo.
I want to separate the schema declaration of drizzle to internal package. But when I tries to export typeof schema/drizzle instance, it loses the information about tables.

I tried using tsc, esbuild, tsup but still no luck.
Is there anyone successfully compiled type of the schema?
Was this page helpful?