How to make this to compile? ```Modifier.width(Bre...
# kobweb
n
How to make this to compile?
Copy code
Modifier.width(Breakpoint.LG.toWidth())
I currently use the following non-type-safe solution:
Copy code
styleModifier {
  property("width", Breakpoint.LG.toWidth())
}
d
You can try this
Copy code
Modifier.width(Breakpoint.LG.toPx() as CSSpxValue)
Thanks to your comment, I'll be updating
toPx
to return CSSpxValue in the next version of Kobweb (at which point you could remove the cast) Alternately, you can tell the compiler that you're smarter than it is:
Copy code
Modifier.width(Breakpoint.LG.toWidth().unsafeCast<CSSLengthNumericValue>())
which is now also something I'm considering doing in the next version of Kobweb as well.
1
🙏 1
(Between those two choices I would probably suggest the second
unsafeCast
one, but I'm testing right now if that will actually work)
🙏 1
n
suggest the second
unsafeCast
one
It works for me, thanks :)
d
FYI I'll ping here in about 10 minutes. 0.16.3-SNAPSHOT is going up now with this fixed.
😮 1
❤️ 1
If you're happy with the unsafeCast, then you're golden!
👍🏻 1
But if you're willing to use the snapshot version, I'll ping you when it's ready. Just waiting on GitHub CI at the moment.
Thanks for the report! It was a good one.
👍🏻 1
Especially this is some of the older code in the Kobweb codebase, so it's nice to revisit it now that we've learned a lot more.
0.16.3-SNAPSHOT should be up!
🙌🏻 1