This message was deleted.
# general
s
This message was deleted.
l
Probably not a reason per se: the name of a resource is the key in a map. The value (resource object) doesn't really need the key.
The name is essentially part of the state, rather than part of the resource.
w
It would be really useful when creating resources based on other resources.
l
In a ComponentResource? I just pass the name straight through.
Or sometimes append something to it.
w
Yes of course that's what I want to do but then you end up having to push this extra parameter around and duplicate it all over the place
I'll show you an example, one minute
l
If you're constructing resources outside of the constructor, yes, you do currently have to do that 😞 Unless maybe you can duck-type the name somehow?
Yep, looks like this might be worth a try if you don't mind sneaking under the covers:
const internalName = (resource as any).__name;
w
Oh yeah cool that will do.
Thanks
👍 1
l
Usual caveat: may break without warning. Undocumented internal code. Etc.