deno icon indicating copy to clipboard operation
deno copied to clipboard

`compileOptions` in `deno.json` doesn't support `skipLibCheck`

Open iuioiua opened this issue 1 year ago • 3 comments

Enabling this setting can be a performance benefit to a codebase when type-checking of .d.ts files isn't required.

See https://github.com/denoland/deno_std/pull/4134 See https://www.typescriptlang.org/tsconfig#skipLibCheck

iuioiua avatar Jan 08 '24 21:01 iuioiua

I don't think there will be much of a performance improvement here because we already do this for remote modules when you don't specify --all (ex. deno check --all). I'm not really sure it's worth adding to Deno actually since we already have the default and --all.

dsherret avatar Jan 08 '24 23:01 dsherret

@dsherret does this option in TSC works in the same way as our --all flag - ie. does it still type check them but doesn't produce diagnostics?

bartlomieju avatar Jan 09 '24 00:01 bartlomieju

I think I found a use case for this, however I'm not entirely sure.

I think it's related to these, but I'm also not entirely sure of that:

  • https://github.com/microsoft/TypeScript/issues/33111
  • https://github.com/microsoft/TypeScript/issues/33901

Quote from https://github.com/microsoft/TypeScript/issues/33111:

FWIW I don’t think --skipLibCheck prevents the types from being pulled in - it just stops the .d.ts files themselves from being type checked. That was my understanding, anyway.


Anyways, my personal case is the following: I imported https://github.com/xstevenyung/fresh-seo into my fresh.config.js in my fresh project. The file https://github.com/xstevenyung/fresh-seo/blob/main/src/sitemap.ts there has this at the top:

/// <reference no-default-lib="true" />
/// <reference lib="dom" />
/// <reference lib="dom.asynciterable" />
/// <reference lib="deno.ns" />
/// <reference lib="deno.unstable" />

Notice how there's no dom.iterable? Yep, this caused my whole codebase (or at least the Deno vscode extension) to suddenly not know about dom.iterable anymore, not just this file, even though I explicitly added dom.iterable to my deno.json compilerOptions.lib array. Maybe I'm doing something wrong here as well but it took me hours to find out why my FormData or URLSearchParams suddenly have no entries() anymore...

Again, I'm not really sure if skipLibCheck would fix that and at this point I'm too afraid to ask because there are seemingly half a dozen different ways to include libraries in TypeScript (triple slash stuff, .d.ts files, normal .ts files, tsconfig.json, jsconfig.json, deno.json, ...). But it would be nice to have an on-and-off-switch for this "intended" behavior of dependencies screwing up my local typechecking, and if skipLibCheck could be that switch, I'd very much appreciate it being added to the deno.json compilerOptions.

nnmrts avatar Feb 11 '24 20:02 nnmrts