policyfly / vue-script-tsc

A lightning fast TypeScript type checker for Vue SFC Script tags

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Enhancement] Respect `files`/`include` in tsconfig.json

laurence-myers opened this issue Β· comments

I'm working on a project which has noImplicitAny: false in tsconfig.json. I'd like to add a separate config file tsconfig.strict.json, with noImplicitAny: true, so I can type check a subset of files, and incrementally improve the codebase.

It looks like vue-script-tsc will pick up all .vue files in src/, regardless of what's defined in the files or include properties in tsconfig.json.

Would it be possible to respect the config's files/includes when discovering the files to type check? I think it could just be a matter of "filtering" the files with glob (or similar).

@laurence-myers Thanks for this suggestion, this a good use case and one I want to add support for. I wonder if TS will report the files it matches with a .vue extension even if it doesn't end up reading them. If so this may actually be a simple fix.

One thing to clarify, TS will by default pick up dependencies and check them too. So if you have the following structure:

src/
  - clean/
    - ComponentClean.vue
  - to-update/
    - ComponentDirty.vue

If you are importing ComponentDirty into ComponentClean, even if you only ran the type check on the clean directory it would still fail because ComponentDirty is a dependency. I think it's best to keep this caveat as it is more in line with how TS does type checking, if instead you wanted to ignore those dependencies too this would have to be under a new flag or something.

πŸŽ‰ This issue has been resolved in version 1.2.0 πŸŽ‰

The release is available on:

Your semantic-release bot πŸ“¦πŸš€