https://pulumi.com logo
#typescript
Title
# typescript
w

wonderful-twilight-70958

11/29/2021, 3:32 PM
Any recommended patterns for sharing types across pulumi projects? (I'm new to TS, so maybe the answer is "the regular ts way!", but just thought I'd ask). Also is it an anti-pattern to be exporting complex objects from stacks? Or generally fine?
f

fast-easter-23401

11/29/2021, 5:18 PM
Hi there John, We use custom types and interfaces across a number of projects, that we're referencing using relative paths (I come from the python world so I couldn't say how idiomatic our approach is).
Copy code
|_ components
   |_ kubernetes
   |_ DB
|_ models (this is where our types live)
As for exports, my team and I are rather parsimonious so to speak: we're exporting outputs required to provision resources that are somehow related. Though it is possible to export complex objects, I would rather export simply strings, thereby preventing users from gaining access to protected/confidential resources. Does that make sense?
l

little-cartoon-10569

11/29/2021, 8:07 PM
It's usually best to stay away from exporting types with constructors that have side effects. If you exporting simple JSON objects, you're fine.
👍 1