Fix TS2307: Cannot find module '*.less'
TypeScript project reads module from declaration files, when the module is not defined or broken, tslint will throw an error like below:
TS2307: Cannot find module './index.less' or its corresponding type declarations.
To fix it, you must make sure your module is defined in one of any declaration files.
// declaration.d.ts
// declare module
declare module '*.scss';
// configure for css-modules
declare module '*.less' {
const content: { [className: string]: string };
export default content;
}
If the error exists, please check if there's an error in your declaration file. Make sure NOTHING OTHER THAN
declare module
is defined in the file, or it can't be recognized by TypeScript.