We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
目前 css modules 的类型处理是生成这样的提示,代码见 https://github.com/umijs/tnf/blob/b34554b/src/sync/write_types.ts#L67-L78 。
declare module '*.less' { const classes: { [key: string]: string }; export default classes; } declare module '*.css' { const classes: { [key: string]: string }; export default classes; }
但是,在使用 css modules 时,比如
import styles from 'foo.module.css';
styles.xxx 时会没有具体 key 的提示。
styles.xxx
参考: https://github.com/mrmckeb/typescript-plugin-css-modules
1、使用 typescript-plugin-css-modules 2、优先尝试在 write_types.ts 里自动加此 plugin,让用户无需感知 3、如果不行,在脚手架里添加依赖和对应的 compilerOptions.plugins
{ "compilerOptions": { "plugins": [ { "name": "typescript-plugin-css-modules" } ] } }
typed-css-modules ,但缺点是会生成一堆 .d.ts 文件。
参考: https://github.com/Quramy/typed-css-modules
would make my life easier
No response
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Problem
目前 css modules 的类型处理是生成这样的提示,代码见 https://github.com/umijs/tnf/blob/b34554b/src/sync/write_types.ts#L67-L78 。
但是,在使用 css modules 时,比如
styles.xxx
时会没有具体 key 的提示。参考:
https://github.com/mrmckeb/typescript-plugin-css-modules
Solution
1、使用 typescript-plugin-css-modules
2、优先尝试在 write_types.ts 里自动加此 plugin,让用户无需感知
3、如果不行,在脚手架里添加依赖和对应的 compilerOptions.plugins
Alternatives
typed-css-modules ,但缺点是会生成一堆 .d.ts 文件。
参考:
https://github.com/Quramy/typed-css-modules
Importance
would make my life easier
Additional Information
No response
The text was updated successfully, but these errors were encountered: