Is there any way to make pulumi less greedy when i...
# typescript
Is there any way to make pulumi less greedy when it comes to collecting properties from exported objects? I understand why it would happen but it's not ideal that even
properties on classes (in ts) end up in output. I had hoped
might give pulumi some more sense as to what should actually be exported but alas, it does not. Context: exporting reference to a ComponentResource instance.
Generally: don't export objects from the Pulumi program.
flag is just a TS thing. It doesn't affect anything at runtime. Try the new
prefix that is a real private field for JS
But I would still not generally export entire instances, make an object just with the properties you want to export:
Copy code
export const componentFoo = {
  propA: foo.propA,
  propB: foo.propB,
I prefer this way, but you can try the
field (I never tried, but I think it should work)
Yeah that makes sense. Though honestly the Component was actually the unit of composition and encapsulation I was hoping I could use as "what should be shared".
Feel like it might fit in with the scope of a component to more explicitly define it's output interface. Will try find time and draft a feature proposal
I don't think it would be feasible. Too much happens in ComponentResource constructors. It's unlikely that a stack reference could construct a ComponentResource without side effects.
And you certainly wouldn't want the resource to be constructed in two projects / stacks.