gold3n
gold3n3w ago

Is it possible to import styles and use them in a Typescript React component when using Vite+Deno?

deno check always complains when I try to do things like import { styles } from './MyComponent.module.css' and then use them like className={styles.myHeader}. When I do import * as styles from './MainHeader.module.css' it stops complaining about the import but then complains when I use properties like className={styles.myHeader} and says that myHeader doesn't belong there. This is for CSS modules but I guess I'd have the same issue without modules, as long as I try to access properties in component. The app can work thanks to vite but not without deno linter / deno check issues. I've tried to add things like this but it didn't help in the end.
declare module "*.module.css" {
export const styles: {
readonly [key: string]: string
}
}
declare module "*.module.css" {
export const styles: {
readonly [key: string]: string
}
}
Is there officially no way to make this work without linter issues?
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?