Convention question: when creating component resou...
# typescript
l
Convention question: when creating component resource classes, does anyone separate the args passed to super() from the args used in the component resource? I've just recommended to someone that they don't do this, but I think the recommendation is personal bias based on all code I've seen or written. Can anyone think of a reason to pass in two args parameters to a constructor: one to be passed to super(), and one specifically for the specific class?
b
ooh i’ve never even thought of doing this, but it could be interesting 🤔
l
What are the args that get passed to super used for? I've advised that they're essentially not used, so it's safe to pass them through. The other dev had wanted to keep the strongly-typed args interface used for our class separate from the weakly-types no-generic Record (Inputs) that gets passed to super().
But I couldn't see a reason to do that.
c
The parent
ComponentResource
class'
args
used to be designated as "reserved for future use". I see that the doc comment for that property now says something different. Or maybe I am misremembering that. I am not sure how it gets used either. Maybe as part of multi-lang components? But for all of my components, I've just been passing
undefined
for
args
when I call
super()
.