https://www.boundaryml.com logo
🟡 Issue with autogenerated import in typescript g...
# questions
s
Hey there. Question about the generators for typescript. When the generator builds the client, it autogenerates types.ts (woohoo! This has been great so far!). It includes this line
import type { Image, Audio, Pdf, Video } from "@boundaryml/baml"
unfortunately. I want to remove this import line. None of those types are being used. The presence of the "@boundarml/baml" is preventing us from importing this file on the FE and thus preventing us from exporting baml types to the FE (I think webpack doesnt know how to import from that dep). Is there a way (in the generator.baml?) to remove that import?
v
ah! what file are you tyring to import in your frontend btw?
if you want types in your frontend, we recommend doing:
Copy code
ts
import type { MyType } from "baml_client"
import as type instead of wildcard import
not sure why TS doesn't fix that T_T
s
I want to import the baml_client/types.ts file. But as soon as it starts to read types.ts it hits the
import type { Image, Audio, Pdf, Video } from "@boundaryml/baml"
line and fails
v
ah sorry i meant:
Copy code
import type { MyType } from "baml_client/types"
that should work, basically
import type
instead of just
import
when in frontend code
s
yeah that worked! Ty. I didn't realize that bypassed the @boundary part.
v
🙂
a
oh derp a good change to our docs would be to change examples to do this