Skip to content

deno check ignores compilerOptions.types in deno.json #27062

@skeithtan

Description

@skeithtan

Version: Deno 2.1.1

In my deno.json, I have compilerOptions and imports defined like so:

{
  "compilerOptions": {
    "types": ["@testing-library/jest-dom"]
  },
  "imports": {
    "@testing-library/jest-dom": "npm:@testing-library/jest-dom@^6.6.3",
  }
}

And I run deno check to check the entire source with a path to the json file like so: deno check --config ./deno.json ./src/.

But when I run that, it gives me all the errors I expect to be resolved by the types option:
(These are functions extended by Testing Library. In Node they would be fixed through tsconfig.json)

TS2339 [ERROR]: Property 'toBeInTheDocument' does not exist on type 'Assertion<HTMLElement>'.
    expect(getByText(/diagnostic/i)).toBeInTheDocument();
                                     ~~~~~~~~~~~~~~~~~

And, more importantly, it goes away when I add this at the top of the file:

// @ts-types="@testing-library/jest-dom"

Or

// @deno-types="@testing-library/jest-dom"

Shouldn't deno check be able to do this automatically through the deno.json file?

However it seems to ignore the reference type directives as well:

/// <reference types="@testing-library/jest-dom" />

or

/// <reference types="@testing-library/jest-dom/types/matchers.d.ts" />

Metadata

Metadata

Assignees

Labels

bugSomething isn't working correctlytscrelated to the TypeScript tsc compiler

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions