---
title: "Fix TS2307: Cannot find module '*.less'"
date: 2022-10-01T15:40:59.000Z
author: Z.SHINCHVEN
tags: [TypeScript, Less, Module]
canonical: https://atlassc.net/2022/10/02/ts2307-cannot-find-less-module
---
TypeScript project reads module from declaration files, when the module is not defined or broken, tslint will throw an error like below:

```text
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.

```TypeScript
// 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.
