New encoding for methods described by type maps #343
oyvindberg
started this conversation in
Ideas
Replies: 2 comments 3 replies
-
Why not simply : @js.native
trait Document extends js.Object {
def createElement(tagName: "a"): HTMLAnchorElement = js.native
def createElement(tagName: "a", options: ElementCreationOptions): HTMLAnchorElement = js.native
def createElement(tagName: "abbr"): HTMLElement = js.native
def createElement(tagName: "abbr", options: ElementCreationOptions): HTMLElement = js.native
} |
Beta Was this translation helpful? Give feedback.
2 replies
-
Bumping into the discussion 👀 import scala.annotation.targetName
@js.native
trait Document extends js.Object {
@targetName("createElement_article") // Maybe @JSName("createElement") is required too
def createElement(tagName: "article"): HTMLElement = js.native
@targetName("createElement_article")
def createElement(tagName: "article", options: ElementCreationOptions): HTMLElement = js.native
@targetName("createElement_abbr")
def createElement(tagName: "abbr"): HTMLElement = js.native
@targetName("createElement_abbr")
def createElement(tagName: "abbr", options: ElementCreationOptions): HTMLElement = js.native
} This way, the compiler will generate createElement("article")
createElement("abbr") |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
As a part of trying to adapt the ST encoding to true literal types this is one of the problems that needs solving, because all the resulting methods are prone to either name or erasure clashes, or they need to receive long, ugly names.
I'm trying out discussion to see if somebody has any ideas for alternative paths forward
given this:
Now this is generated:
The new proposal is to generate something like this:
It can be used like this:
Pros:
Cons:
Beta Was this translation helpful? Give feedback.
All reactions