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
Advanced typing for classnames/bind #300
Comments
Wow, man you're a genius! |
And for those who are stumbling upon this thread, here's the way I solved typed css modules with classnames.bind:
I prefer installing a VS Code extension rather than a webpack plugin or a standalone script because: 1) I'm a bit afraid of changing the webpack configuration ; and 2) I already have so many scripts running in my terminal, I prefer to keep it lean. |
Glad that worked out for you! Didn't have time to integrate it ourselves, the issue with generating .d.ts too late stuttered me. Not sure if those are still issues using vscode extension (i'm using `JetBrains line, not even sure there is a similar extension for me). If not, it would probably have to be some IDe-integrated in-memory stylesheet type parser. Keep us posted If you run in any issues with your setup. :) |
This seems to overlap with #299, so I will close this as duplicate. If you think this suggestion could fix the typing issues mentioned there feel free to create a PR. |
Been looking for a way to type classnames properly for quiet some time, found a way:
Using https://www.npmjs.com/package/css-modules-typescript-loader along with advanced classnames/bind typing would let us typecheck all the bound arguments, leveling classnames/bind up to the new heights.
Would a PR with the following typing be welcome?
Works for both strings and record:
The text was updated successfully, but these errors were encountered: