This message was deleted.
# typescript
s
This message was deleted.
g
It can be done, not sure if it is a great idea to do it for all `ComponentResource`s, it would be a breaking change for everyone not setting the parent. You can create a
AutoParentComponentResource
and use that as your base class.
l
I just added a lint rule that requires that every resource constructor is passed all parameters (opt is no longer optional). And our standard shape for constructing child resources is
const child = new Resource(name, args, { ...opts, parent: parent})
. The splat / spread operator is great here. I don't recommend using
parent: this
unilaterally. Lots of child resources in my stacks are children of children, so
this
would be wrong.
b
Thank you both! This makes sense. I’ll try both out and see if they work for me 🙂