-
Notifications
You must be signed in to change notification settings - Fork 63
Add progressive TypeScript compilation #503
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Adding a type error produced the expected result.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great start! I tried adding use-related
to the include
array - and Oh wow, it's so much work :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a major boost for DX!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This extra help with types is excellent! ✨
Fixes
Fixes #175 by @sarayourfriend
Description
Replaces
jsconfig.json
with atsconfig.json
that mirrors Gutenberg's with some changes to accomodate not being a composite project.Currently this only checks a single file, basically in an effort to minimize the size of this PR while also still proving that it does work as intended. I had to make a small update to the type declarations in this file to get the compiler to pass. Hooray for type feedback! 🎉
Future work will include slowly adding each file in
src/composables
to theinclude
array. We can also start running the type checker on other parts of the codebase like the services 🙂 I would propose doing this in small isolated bits and pieces to avoid having to make too many changes in a single PR to address the inevitable error here and there.Testing Instructions
Checkout the PR and run
npm run types
. Everything should come back without an error. Next, updateuse-event-listener-outside.js
to include a type error. For example, add the following somewhere in the file:This is a type error becuase you can't assign
null
to astring
. Your IDE should pick this up and give you some squiggly lines or a warning (however your IDE normally picks up compilation errors). You should now also be able to runnpm run tsc
and have it report back the error to you.Go ahead and try to commit that (you'll have to disable the eslint
no-unused-vars
rule temporarily to be able to run the pre-commit) and pre-commit should fail on thetsc
step.Checklist
Update index.md
).main
) or a parent feature branch.Developer Certificate of Origin
Developer Certificate of Origin