-
Notifications
You must be signed in to change notification settings - Fork 307
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
using data attributes token conversions break sometimes #689
Comments
I could be wrong, but this could work: const styles = stylex.create({
div: {
[text.fontWeight]: {
":is([data-size='default'])": stylex.types.integer(500),
":is([data-size='large'])": stylex.types.integer(600),
},
},
}); |
@srikrsna that might fix a type error (not sure if the TS types are even strict enough for that), but other than that
Looks like the bug reported is that the values are being converted to |
@nmn yeah, I'd expect if I used a |
@lifeiscontent That is a fair expectation, but to ensure that we can cache the result of compiling individual files, when you assign a variable, the compiler doesn't know what type the variable was initialised with. I'm put up a PR that doesn't do any conversion for variables, so numbers will be maintained, as length values will need to be written as We should also update or create a new lint rule to enforce that variable values are always strings. |
@nmn thanks for the context, that makes sense. 👍🏻 |
Describe the issue
in this code:
text.stylex.ts
component.tsx
500
and600
resolve to500px
and600px
Expected behavior
I'd expect the value to remain intact
Steps to reproduce
create a component that applies the data property and see the styles resolve to
500px
,600px
Test case
do you guys have a sandbox you'd like me to put a repro together in?
I can do it in a follow up comment if so
Additional comments
No response
The text was updated successfully, but these errors were encountered: