Skip to content

deno check ignores JSX compilerOptions from deno.json when a tsconfig.json is present #33180

@quentinadam

Description

@quentinadam

Versions

  • Deno version: 2.7.11
  • OS: macOS (Darwin)
  • TypeScript version (bundled): 5.9.2

Description

When a project has valid JSX-related compilerOptions (jsx and jsxImportSource) in deno.json, running deno check works correctly. However, if a tsconfig.json file exists in the project root (even an empty one), deno check fails with JSX-related TypeScript errors.

It appears that the presence of a tsconfig.json causes Deno to ignore the JSX compiler options defined in deno.json. This issue seems to be specifically related to JSX configuration (jsx and jsxImportSource options).

Reproduction

Minimal reproduction repository: https://github.com/quentinadam/deno-tsconfig-issue

Steps to reproduce:

  1. Clone the repository:

    git clone https://github.com/quentinadam/deno-tsconfig-issue.git
    cd deno-tsconfig-issue
  2. Run deno check:

    deno check Component.tsx

    Result: Fails with errors

  3. Remove or rename tsconfig.json:

    mv tsconfig.json tsconfig.json.bak
    deno check Component.tsx

    Result: Succeeds

Docker reproduction (clean environment):

docker run --rm -v "$(pwd)":/app -w /app denoland/deno:latest sh -c "
  echo '--- With tsconfig.json ---' &&
  deno check Component.tsx;
  echo '--- Without tsconfig.json ---' &&
  mv tsconfig.json tsconfig.json.bak &&
  deno check Component.tsx;
  mv tsconfig.json.bak tsconfig.json
"

This confirms the issue in a fresh Deno environment with no local cache.

Project structure:

deno.json:

{
  "imports": {
    "preact": "npm:preact@^10.29.1"
  },
  "compilerOptions": {
    "jsx": "react-jsx",
    "jsxImportSource": "preact"
  }
}

tsconfig.json:

{}

Component.tsx:

export function Component() {
  return <div>Hello world</div>;
}

Error output

Check Component.tsx
TS7026 [ERROR]: JSX element implicitly has type 'any' because no interface 'JSX.IntrinsicElements' exists.
  return <div>Hello world</div>;
         ~~~~~
    at file:///[...]/Component.tsx:2:10

TS2875 [ERROR]: This JSX tag requires the module path 'preact/jsx-runtime' to exist, but none could be found. Make sure you have types for the appropriate package installed.
  return <div>Hello world</div>;
         ~~~~~~~~~~~~~~~~~~~~~~
    at file:///[...]/Component.tsx:2:10

Found 3 errors.

error: Type checking failed.

Expected behavior

According to the Deno TSConfig migration documentation:

If a parent deno.json contains compilerOptions, that will take precedence over any TSConfig.

Based on this documented behavior, deno check should succeed because the compilerOptions in deno.json should take precedence over the empty tsconfig.json. However, this is not what happens in practice for JSX-related options.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions