fern-api / fern

Input OpenAPI. Output SDKs and Docs.
https://buildwithfern.com
MIT License
2.55k stars 129 forks source link

[Bug] Barrelled exports are not using export type-only in Typescript client #2773

Open tomtobac opened 7 months ago

tomtobac commented 7 months ago

Describe the bug

Nextjs forces --isolatedModules and whenever we generate our typescript-sdk and try to import it from our monorepo it crashes on build time.

Type error: Re-exporting a type when the '--isolatedModules' flag is provided requires using 'export type'.

> 1 | export { ChatStreamRequest } from "./ChatStreamRequest";
    |          ^
  2 | export { ChatRequest } from "./ChatRequest";

Expected behavior It should export interfaces using type-only imports

export type { ChatStreamRequest } from "./ChatStreamRequest";
export type { ChatRequest } from "./ChatRequest";

Versions

dsinghvi commented 7 months ago

Oh interesting -- @tomtobac thanks for this issue!

dsinghvi commented 5 months ago

@tomtobac did you get around this?

brentshulman-silkline commented 3 months ago

@tomtobac did you get around this?

I have the same issue