Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tag support for Scala 3 #643

Open
steinybot opened this issue May 25, 2023 · 1 comment
Open

Tag support for Scala 3 #643

steinybot opened this issue May 25, 2023 · 1 comment

Comments

@steinybot
Copy link
Contributor

This issue is for doing something about T#tagType which is not supported in Scala 3, as mentioned in #494.

  type supports[T <: Tag] = AttrPair[attrType] => AttrPair[T#tagType]

Changing that to something like:

type supports[T <: Tag] = Conversion[AttrPair[attrType], AttrPair[T]]

could be an option but then there is the question of what to do about:

@inline def :=[T <: slinky.core.TagElement](v: slinky.web.SyntheticMouseEvent[T#RefType] => Unit) =
  new slinky.core.AttrPair[T]("onClick", v)

It would probably require an explicit type to be given for the handler which would suck but maybe this could work:

@inline def :=[T <: slinky.core.Tag, R](v: slinky.web.SyntheticMouseEvent[R] => Unit) =
  new slinky.core.AttrPair[T]("onClick", v)

This then begs the question, should AttrPair (and TagMod) keep the A phantom type? I'm not so sure.

Perhaps there is a better way to represent which attributes a tag supports.

@shadaj shadaj added the scala3 label Aug 12, 2023
@shadaj
Copy link
Owner

shadaj commented Aug 12, 2023

Yeah, unfortunately maybe the answer is just to give up on inferred DOM types for events and require the user to do manual casting. I'll try to think if there is some workaround but there doesn't seem to be one based on my (limited) knowledge of Scala 3's type member support.

@shadaj shadaj added the bug label Aug 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants