deno: `AbortSignal.reason` not available in `lib.dom.d.ts`

Something has changed in deno v1.21.0, as upgrading from v1.20.6 has caused TS errors to fail tests that used to run fine:

deno test \
  --unstable \
  --allow-env \
  --allow-net \
  --allow-run \
  --allow-read \
  --allow-write \
  --import-map=importMap.json
Check file://[redacted]/ruck/Effect.test.mjs
Check file://[redacted]/ruck/HeadManager.test.mjs
Check file://[redacted]/ruck/HeadManagerContext.test.mjs
Check file://[redacted]/ruck/Html.test.mjs
Check file://[redacted]/ruck/LinkCss.test.mjs
Check file://[redacted]/ruck/NavigateContext.test.mjs
Check file://[redacted]/ruck/RouteContext.test.mjs
Check file://[redacted]/ruck/TransferContext.test.mjs
Check file://[redacted]/ruck/assertImportMap.test.mjs
Check file://[redacted]/ruck/createPseudoNode.test.mjs
Check file://[redacted]/ruck/documentHasStyleSheet.test.mjs
Check file://[redacted]/ruck/hydrate.test.mjs
Check file://[redacted]/ruck/publicFileResponse.test.mjs
Check file://[redacted]/ruck/readImportMapFile.test.mjs
Check file://[redacted]/ruck/routePlanForContentWithCss.test.mjs
Check file://[redacted]/ruck/scrollToHash.test.mjs
Check file://[redacted]/ruck/serve.test.mjs
Check file://[redacted]/ruck/useOnClickRouteLink.test.mjs
error: TS2339 [ERROR]: Property 'reason' does not exist on type 'AbortSignal'.
    return Promise.reject(createAbortError(signal.reason));
                                                  ~~~~~~
    at https://deno.land/std@0.136.0/async/abortable.ts:27:51

TS2339 [ERROR]: Property 'reason' does not exist on type 'AbortSignal'.
  const abort = () => waiter.reject(createAbortError(signal.reason));
                                                            ~~~~~~
    at https://deno.land/std@0.136.0/async/abortable.ts:30:61

TS2339 [ERROR]: Property 'reason' does not exist on type 'AbortSignal'.
    throw createAbortError(signal.reason);
                                  ~~~~~~
    at https://deno.land/std@0.136.0/async/abortable.ts:46:35

TS2339 [ERROR]: Property 'reason' does not exist on type 'AbortSignal'.
  const abort = () => waiter.reject(createAbortError(signal.reason));
                                                            ~~~~~~
    at https://deno.land/std@0.136.0/async/abortable.ts:49:61

Found 4 errors.

That output implies there is some kind of type check issue in useOnClickRouteLink.test.mjs, but the Deno LSP doesn’t surface any in VS Code when looking at the module, and according to the new deno check command there are no type check issues with it:

deno check --import-map=importMap.json useOnClickRouteLink.test.mjs
Check file://[redacted]/ruck/useOnClickRouteLink.test.mjs

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (5 by maintainers)

Commits related to this issue

Most upvoted comments

TS triple slash lib references are only meant to apply to the module with the comment in it and down in the module graph.

No, they’re global. There’s no way to do that in TS at the moment 😦

Why would it be more relaxed when you are explicitly running a command to check types, than when you are just running tests.

This is due to the new change that is gonna happen in Deno 2.0 (most likely). Typechecking is super slow especially once you get alot of bigger deps. Therefore it will be the modules responsibility to typecheck their code (which they already do because of unit tests, benchmarks and testing their code manually) and your responsibility to typecheck your’s rather than you typechecking everything. This should speed up start up time without having any real drawback

Why does current version Deno type checking only notice a type error in a particular module when using deno test, but not deno check?

Because deno check’s default type checking mode does not check remote modules (like deno run --no-check=remote)