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

Detect invalid class name when using CSS module #5162

Open
Doeke opened this issue Feb 4, 2025 · 0 comments · May be fixed by #5164
Open

Detect invalid class name when using CSS module #5162

Doeke opened this issue Feb 4, 2025 · 0 comments · May be fixed by #5164

Comments

@Doeke
Copy link

Doeke commented Feb 4, 2025

What problem does this feature solve?

It would be nice to see a type error if we make a typo in a class name when using CSS modules. Currently the type for useCssModule() is defined like Record<string, string> & { class1: string, ... }, would it be possible to remove the Record and just have it be of type { class1: string, ... }? Perhaps this could be added with a TS config option to enable it, similar to strictTemplates etc?

What does the proposed solution look like?

<script setup>
const { wrongClass } = useCssModule()
/// ^ Error: Property 'wrongClass' does not exist on type
</script>
<style module>
.class1 { color: red }
</style>
@KazariEX KazariEX linked a pull request Feb 4, 2025 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