webpack/css-loader

Maybe add TypeScript Declaration update to migration guide?

Closed this issue · 2 comments

fakob commented

Documentation Is:

  • Missing
  • Needed
  • Confusing
  • Not Sure?

Please Explain in Detail...

Hello there, thanks for your work!

Today I upgraded from version 6 to 7 and applied the changes mentioned in the migration guide. As I was using typescript, I then got errors like this:
Property 'menuItemButton' does not exist on type 'typeof import("*.module.css")'.ts(2339)
I did not know, but I had to change my TypeScript Declaration.

Your Proposal for Changes

It might be helpful for others to mention this in the migration guide. Up to you.
In the css case I had to change default to =

declare module '*.module.css' {
  const classes: { [key: string]: string };
  export default classes;
}

to this

declare module '*.module.css' {
  const classes: { [key: string]: string };
  export = classes;
}

Hello, good idea, I will do it

zxkws commented

hi, bro, this is very importan,it cost me about two hours, thank you