"Cannot tell which parent to amend" when using typed parameter in function #303
Unanswered
chrisvander
asked this question in
Q&A
Replies: 1 comment 3 replies
-
What's the purpose of |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi; let's say I have a need for nesting an object as per a config specification. So I have two classes, a wrapper "parent", and the "body" or main configuration. And let's say, since I'm publishing this as a module and want to configuration to be easy + flat for the user of my module, I make a function to create the class.
I would like to use the
create()
function as way to instantiate the object. In my module's docs I could recommend using it. Let's say my module is calledobj
for simplicity.The experience isn't perfect. I would have thought
newObj = obj.create("test", new { value = 2 })
would work, but that results in the error "Cannot tell which parent to amend." So, the user would have to type the more verbosenewObj = obj.create("test", new obj.ObjBody { value = 2 })
.I kind of want the usage of
ObjBody
to be hidden to the user of my module; it's not relevant. All they need to know is they're making anObj
. Will this use case be supported? Is there an alternative that I'm not thinking of here?Beta Was this translation helpful? Give feedback.
All reactions