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

Missing support for stacking pseudo classes #368

Closed
1 of 2 tasks
bstro opened this issue Jan 17, 2022 · 5 comments
Closed
1 of 2 tasks

Missing support for stacking pseudo classes #368

bstro opened this issue Jan 17, 2022 · 5 comments
Labels
bug Something isn't working

Comments

@bstro
Copy link
Contributor

bstro commented Jan 17, 2022

Environment:

  • TailwindCSS version: ^3.0.15
  • tailwindcss-classnames version: ^3.0.2
  • Node.js version: 14.17

Current Behavior

Using a multiple pseudo classes together throws a type error.
In this case, I attempted to combine hover:… and active:….
image

Expected Behavior

I should be able to stack pseudo classes in this way with no type-errors.

  • I've searched the issues list and this is not a duplicate
  • I'm willing to fix this error
@bstro bstro added the bug Something isn't working label Jan 17, 2022
@muhammadsammy
Copy link
Owner

muhammadsammy commented Jan 18, 2022

Honestly, I do not know how to support this feature + it would generate a huge number of classnames types that the TS engine could not handle, that's why support for opacity suffix feature was also dropped
#315

@bstro
Copy link
Contributor Author

bstro commented Jan 18, 2022

Ah, that makes sense. Is there any kind of escape hatch helper so that I could still use classes like active:hover:… without the type system yelling at me? Something like classnames(backgroundColor('bg-gray-100'), unsafe('active:hover:bg-gray-200)

@muhammadsammy
Copy link
Owner

yes, you can cast the string to TTailwindString type:

backgroundColor('bg-gray-100', 'active:hover:bg-gray-200' as TTailwindString)

@bstro
Copy link
Contributor Author

bstro commented Jan 20, 2022

How would one do that in the case of conditionals?

  backgroundColor({
    ['active:hover:bg-gray-200' as TTailwindString]: someConditionalActiveStateBool
  })

I spose? I'll write my own helper probably for this case.

Thanks for your help!

@bstro bstro closed this as completed Jan 20, 2022
@bstro
Copy link
Contributor Author

bstro commented Jan 20, 2022

also p.s. thanks for building this, i'm finding it super helpful. 💚

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants