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

A way to disable checking for certain files only #13463

Closed
jespertheend opened this issue Jan 21, 2022 · 2 comments
Closed

A way to disable checking for certain files only #13463

jespertheend opened this issue Jan 21, 2022 · 2 comments
Labels
question a question about the use of Deno

Comments

@jespertheend
Copy link
Contributor

I'd like to enable strict typing for js files, since all files in my project are written in js. But this causes strict typing to get enabled for all other files as well, including imported libraries. For example:

import { createHash } from "https://deno.land/std@0.118.0/hash/mod.ts";

const hash = createHash("md5");
hash.update("test");
console.log(hash.toString());

With the following deno.json:

{
  "compilerOptions": {
    "allowJs": true,
    "checkJs": true,
    "strict": true
  }
}

doesn't have any type errors, but https://deno.land/std@0.118.0/hash/_wasm/wasm.js does, and so a whole bunch of errors are emitted and the file is not run.

The only solution to this that I'm aware of it to disable allowJs and put //@ts-check at the top of the file. But I'd really rather not have to do that for every file across my project, it's prone to errors and just overall pretty tedious.

I realise this is a bit of a weird request, this seems more like a TypeScript issue than a Deno issue. The difference is, if I import a .js library in TypeScript, I can at least fix the issue by adding @ts-nocheck to that library. In Deno I don't have any control over the contents of external files.

One related TypeScript issue mentions being able to provide a list of paths where all errors are suppressed, so perhaps this is something that should be fixed in TypeScript rather than Deno. But even then it would still have to support suppressing urls somehow.

@nayeemrmn
Copy link
Collaborator

Since it's precisely uncontrollable remote modules that you want to omit, use deno run --no-check=remote main.ts.

@kitsonk kitsonk added the question a question about the use of Deno label Jan 22, 2022
@jespertheend
Copy link
Contributor Author

Ah thanks! I wasn't aware of this functionality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question a question about the use of Deno
Projects
None yet
Development

No branches or pull requests

3 participants