Use the Typescript Compiler API to output types

24 views Asked by At

Here is my sample project: https://stackblitz.com/edit/typescript-aqwhct?file=src%2Froutes%2Fusers.ts,src%2Froutes%2Fauth.ts,src%2Frouter.ts,package.json,src%2Fgenerate.ts&terminal=dev

I'm using the Typescript Compiler API to generate and output types for my declared variables. I need advice on how to approach this. I've tried various methods but haven't found a solution after spending hours searching . In the project folder, you will find a router.ts file that imports files from routes/.

There are potentially many files following the same structure, each ending with an object that exports { method: string, handler: (input: any) => any }.

In the generate.ts file, I aim to utilize the compiler API to output the types to a client.d.ts file.

Could someone advise me on how to achieve the desired results?

0

There are 0 answers