Replies: 3 comments 1 reply
-
|
Instead of generating strings, I wonder whether we should create CSSUnitValue, as created by these factory functions (linked from the proposal): https://drafts.css-houdini.org/css-typed-om/#numeric-factory Sadly, Houdini remains in its infancy, though. Looks like this is supported on Chrome but not Firefox nor Safari. https://caniuse.com/mdn-api_cssunitvalue |
Beta Was this translation helpful? Give feedback.
-
It's kind of a heinous API and I wouldn't want to encourage them but we might be able to offer it as a directive. We could probably do a TS trick to get the equivalent type checking but I'm not sure how easy it would flow into React style APIs either. Worth exploring both for sure. |
Beta Was this translation helpful? Give feedback.
-
|
I just bumped into the Frink programming language which seems to have extensive support for natural units. I also like how this enavles If we add units, we should probably aim to support these too. Probably we need our own type/class for this. Civet standard library anyone? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
It would be neat to have units for numeric literals like so:
They wouldn't be super useful until type aware operators but may be worth exploring even before that.
Phase 1
Phase 2
References
https://github.com/tc39/proposal-extended-numeric-literals
Beta Was this translation helpful? Give feedback.
All reactions