plantain-00 / type-coverage

A CLI tool to check type coverage for typescript code
MIT License
1.21k stars 43 forks source link

Crash on omitting `.json` in `extends` field inside `tsconfig.json` #72

Closed JounQin closed 2 years ago

JounQin commented 3 years ago

Version(if relevant): 2.4.0

Environment(if relevant):

Code(if relevant):

{
  "extends": "@1stg/tsconfig/app" // ts understand it correctly same as `@1stg/tsconfig/app.json`
}

Expected:

Don't crash

Actual:

Error: paramter 'project' should be a file or directory.
plantain-00 commented 3 years ago

v2.14.4 should fix this.

JounQin commented 3 years ago

@plantain-00 https://github.com/plantain-00/type-coverage/commit/92330f1132b4677ced00a6356eb8e3387f7fc635#r44422632

plantain-00 commented 3 years ago

v2.14.5 should fix this.

JounQin commented 2 years ago

@plantain-00 I get this error again recently, I tried to log at getTsConfigFilePath with:

console.log(project, fallbackProject)
$ type-coverage
. undefined
/Users/JounQin/Workspaces/Alauda/vision/node_modules/@1stg/tsconfig/app [
  '/Users/JounQin/Workspaces/Alauda/vision/node_modules/@1stg/tsconfig/app',
  '/Users/JounQin/node_modules/@1stg/tsconfig/app'
]
paramter 'project' should be a file or directory.

What means .json is not tried at all again.

plantain-00 commented 2 years ago

Can this code change fixes your case? https://github.com/plantain-00/type-coverage/pull/103

JounQin commented 2 years ago

The logic seems true to me.

plantain-00 commented 2 years ago

2.18.3-alpha.0

JounQin commented 2 years ago

2.18.3-alpha.0

Confirmed working