Home > Software engineering >  Tsconfig show typescript file not found error after change file name
Tsconfig show typescript file not found error after change file name

Time:09-20

i changed an archive name from 'index.ts' to 'style.ts', after that always returns this error in tsconfig.json:

"File '/src/components/AboutContainer/index.ts' not found. The file is in the program because: Matched by default include pattern '**/*'"

here's my tsconfig.json:

{
  "extends": "expo/tsconfig.base",
  "compilerOptions": {
    "strict": true
  }
}

CodePudding user response:

As index.ts is a code component, you might have used it somewhere in the codebase. Later, as you have changed the filename to style.ts,

  • now, index.ts usage or import statements are incorrect as that file doesn't exist anymore
  • Also, the name [index] before the extension .ts or .js, indicates default pattern to match is /.
  • The solution can be, once check the usage of index.ts file and accordingly consider the pattern.

for example : whenever the route is default like / the index.ts code will be considered, as you have changed it, the default should be like /new-name

  • Related