fix(NOJIRA-123): Allow JS+TS files #168
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Some files can't be renamed to have a
.ts
or.tsx
extension. For example,next.config.js
and any files that it requires.https://nextjs.org/docs/pages/building-your-application/configuring/typescript#type-checking-nextconfigjs
However, we can still benefit from Typescript in these files by adding
// @ts-check
at the top of the file. eg https://github.com/Typeform/public-main-site/pull/4089This change changes the typescript check to allow JS files with such an annotation. This will avoid false-negatives when Typescript is used this way, and will encourage Typeformers to adopt JS in these places to make adoption % look better 🙌
In this PR, I'm testing the change in the PR and it passes (because the JS file I've edited is type-checked)
https://github.com/Typeform/public-main-site/pull/4091
And in this PR, I edit a regular JS file and so it complains
https://github.com/Typeform/public-main-site/pull/4095