johnsoncodehk / vue-tsc

vue-tsc --noEmit && vite build
https://www.npmjs.com/package/vue-tsc
MIT License
241 stars 6 forks source link

Use tsconfig.json #1

Closed egoist closed 3 years ago

egoist commented 3 years ago

Seems it doesn't respect tsconfig.json, I've already added es2020 to lib but it still throws this error:

image

johnsoncodehk commented 3 years ago

You cannot use tsconfig.json when you specify a file, see: https://github.com/microsoft/TypeScript/issues/29241

leedalei commented 3 years ago

You cannot use tsconfig.json when you specify a file, see: microsoft/TypeScript#29241

is there any solutions? when I use husky+lint-staged and push this command vue-tsc --noEmit into lint-staged's options,

"lint-staged": {
    "src/**/*.{ts,tsx,js,json,vue}": [
      "prettier --write",
      "eslint --fix",
      "vue-tsc --noEmit"
    ]
  },

it will report an error

node_modules/@vue/reactivity/dist/reactivity.d.ts(219,13): error TS2550: Property 'matchAll' does not exist on type 'SymbolConstructor'. Do you need to change your target library? Try changing the `lib` compiler option to 'es2020' or later.

Seems lint-staged has helped vue-tsc specify some files only in git stage?

my English is poor,hope you can understand, thanks~

johnsoncodehk commented 3 years ago

@leedalei This is typescript limit I think, please try to find a solution on tsc first. (replace vue-tsc --noEmit to tsc --noEmit)

leedalei commented 3 years ago

@johnsoncodehk when using tsc --noEmit it reports an error

error TS6054: File '/Users/leelei/Documents/Work/moonShop/yarn.lock' has an unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts'.
  The file is in the program because:
    Root file specified for compilation   (`Root file specified for compilation` means I've specified some files, right?)

but I've created a tsconfig.json

"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"]

Seems lint-staged has helped vue-tsc specify some files only in git stage, so this tsconfig.json doesn't work .

There is no way to solve this the problem cause it's a limit from typescript, right?

johnsoncodehk commented 3 years ago

There is no way to solve this the problem cause it's a limit from typescript, right?

@leedalei Yes.