Explicit typing for context functions #14129
Adam-Vandervorst
started this conversation in
General Discussion
Replies: 1 comment
-
Moving away from the partial function solved this... def spawn(tag: String) =
(init: TagOf[tag.type] ?=> Unit) => (p: ParentsOf[tag.type]) ?=>
val e = createElement(tag)
init(using e)
p.appendChild(e)
e |
Beta Was this translation helpful? Give feedback.
0 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.
-
I wrote some helper functions like
to allow for a builder pattern approach to Scala.js dom
To avoid the repetition for each element, I thought about writing
to be used as
given
and
However, this context is tried to be resolved immediately, requiring the explicit annotation:
which ultimately doesn't abstract away that much.
Is there some way to prevent this?
For ADT's I use a helper like
that avoids widening a case to the enum, maybe something similar can be used here?
Beta Was this translation helpful? Give feedback.
All reactions