-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor type-checking setup #1969
Conversation
…t checks run separately for type definitions
Please take a look at my vision for this refactor: shadowspawn/commander.js@feature/type-checking...aweebit:commander.js:feature/type-checking. Explanations are given in the commit descriptions and the comment in You can simply merge my branch into yours if you like the changes. |
Moved to Draft while I have a look at ideas from #1969 (comment) |
Co-authored-by: Wee Bit <aweebit64@gmail.com>
FYI @aweebit : I was interested in your idea of having extra |
That is why I named the main TSConfig file
Not sure what you mean by "explicitly" here, but it is supported. Try this on my branch: echo 'export let myVar;' > demo.ts
cp demo.ts typings/demo.ts
code demo.ts # no error
code typings/demo.ts # error |
By the way, I used project references to separate configs in #1975. Works really well. |
By "explicitly" I mean that it is an intended pattern and not just a happy accident it works. e.g. documented, or used in official examples.
Thanks. I did read about project references, but I did not feel it was a good fit. |
Pull Request
Problem
Type-checking of the JavaScript files using TypeScript was quite fragile and partially misconfigured:
@ts-check
comments were not working to enable checks in JavaScript code in VSCode, as only works on first linenpm run typescript-checkJS
than in VSCode so confusingnpm run typescript-checkJS
didn't work on Windows (glob not expanded)Related: #1960 #1962
Solution
tsconfig.json
with less strict settings covering mixed JavaScript and TypeScripttsconfig.ts.json
typecheck-ts
run-scripttypecheck-ts
now included intest
run-script for strict checks on the published TypeScript typingstsconfig.js.json
typecheck-js.json
run-script@ts-check
comments as JavaScript processing now turned on intsconfig.json
Explicitly separates the TypeScript and JavaScript files for using with npm run-scripts et al, and run-script naming, following suggestions by @aweebit.
I also updated the
lib
andmodule
andtarget
settings to match suggested configuration from https://github.com/tsconfig/bases/blob/main/bases/node16.jsonReferences:
ChangeLog