Skip to content
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

Support CheckJS #1068

Merged
merged 1 commit into from
Oct 23, 2018
Merged

Support CheckJS #1068

merged 1 commit into from
Oct 23, 2018

Conversation

kitsonk
Copy link
Contributor

@kitsonk kitsonk commented Oct 23, 2018

Fixes #976

This PR enables the --checkJs TypeScript compiler option. This means that JavaScript will be type checked and users can supply JSDoc type annotations that will be enforced by Deno, reporting type issues when running programmes. This means all JavaScript will be compared to the built in type library and ensure the JavaScript programmes utilise Deno APIs with type safety. The way JavaScript is checked by the TypeScript compiler is very loose, but allows users to incrementally "opt-in" using the JSDoc annotations.

The feature is described here.

While the pragma of // @ts-ignore and // @ts-nocheck work in Deno, it is not recommended they be used as they are simply ignoring a problem that might not yet be a runtime exception, but could/should be. My recommendation is that if there is any JavaScript that should work but fails because of a type error, we look at addressing why that is the case versus just ignoring it.

Copy link
Member

@ry ry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - thanks
Tho, ultimately I think JS should pass through without hitting the TS compiler at all.

@ry ry merged commit dd230d5 into denoland:master Oct 23, 2018
@ry
Copy link
Member

ry commented Oct 23, 2018

This was red in master - I had to revert #1070

ry added a commit to ry/deno that referenced this pull request Oct 27, 2018
- Add URLSearchParams (denoland#1049)
- Implement clone for FetchResponse (denoland#1054)
- Use content-type headers when importing from URLs. (denoland#1020)
- Use checkJs option, JavaScript will be type checked and users can
  supply JSDoc type annotations that will be enforced by Deno (denoland#1068)
- Add separate http/https cache dirs to DENO_DIR (denoland#971)
- Support https in fetch. (denoland#1100)
- Add chmod/chmodSync on unix (denoland#1088)
- Remove broken features: --deps and trace() (denoland#1103)
- Ergonomics: Prompt TTY for permission escalation (denoland#1081)
@ry ry mentioned this pull request Oct 27, 2018
ry added a commit that referenced this pull request Oct 27, 2018
- Add URLSearchParams (#1049)
- Implement clone for FetchResponse (#1054)
- Use content-type headers when importing from URLs. (#1020)
- Use checkJs option, JavaScript will be type checked and users can
  supply JSDoc type annotations that will be enforced by Deno (#1068)
- Add separate http/https cache dirs to DENO_DIR (#971)
- Support https in fetch. (#1100)
- Add chmod/chmodSync on unix (#1088)
- Remove broken features: --deps and trace() (#1103)
- Ergonomics: Prompt TTY for permission escalation (#1081)
@kitsonk kitsonk deleted the checkjs branch August 2, 2022 04:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants