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

number token identifiers get converted to string when strictTokens is turned on #2950

Open
1 of 3 tasks
thecodrr opened this issue Oct 30, 2024 · 0 comments · May be fixed by #2951
Open
1 of 3 tasks

number token identifiers get converted to string when strictTokens is turned on #2950

thecodrr opened this issue Oct 30, 2024 · 0 comments · May be fixed by #2951

Comments

@thecodrr
Copy link

Description

number token identifiers get converted to string when strictTokens is turned on. For example, this:

spacing: {
        0: { value: '0px' },
        1: { value: '5px' },
        2: { value: '10px' },
        3: { value: '15px' },
        4: { value: '20px' },
        5: { value: '25px' },
        6: { value: '30px' },
        7: { value: '35px' },
        8: { value: '40px' },
        9: { value: '45px' },
        10: { value: '50px' },
        11: { value: '55px' },
        12: { value: '60px' }
      }

Gets turned into the following type:

export type SpacingToken = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "-0" | "-1" | "-2" | "-3" | "-4" | "-5" | "-6" | "-7" | "-8" | "-9" | "-10" | "-11" | "-12"

This means when I try to use these tokens in properties, I get a type error:

Type 'number' is not assignable to type 'ConditionalValue<WithEscapeHatch<"auto" | SpacingToken | `var(--${string})`>> | undefined'.

For the following code:

<Heading mb={1} size="h3">

Link to Reproduction

https://play.panda-css.com/dpPQkhbEls

Steps to reproduce

See this happening the the Panda Playground: https://play.panda-css.com/dpPQkhbEls

JS Framework

NextJS

Panda CSS Version

0.47.0

Browser

Mozilla Firefox 1.31.0.3

Operating System

  • macOS
  • Windows
  • Linux

Additional Information

No response

@thecodrr thecodrr linked a pull request Oct 31, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant