From a8b0671cccc146f9626cf0d454dd7a5dcc2072c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Thu, 21 May 2026 12:39:29 +0200 Subject: [PATCH 1/2] docs: document tsconfig.json and jsconfig.json auto-detection on TypeScript page --- runtime/fundamentals/typescript.md | 40 ++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/runtime/fundamentals/typescript.md b/runtime/fundamentals/typescript.md index 48a2ffee1..27256690f 100644 --- a/runtime/fundamentals/typescript.md +++ b/runtime/fundamentals/typescript.md @@ -264,6 +264,46 @@ To specify the library files to use in a TypeScript file, you can use /// ``` +## Configuring TypeScript with `tsconfig.json` {#tsconfig} + +While Deno uses `deno.json` for TypeScript configuration by default, it also +supports `tsconfig.json` for compatibility with existing Node.js and TypeScript +projects, making it easier to adopt Deno incrementally. Each workspace +directory containing a `deno.json` or `package.json` is probed for a +`tsconfig.json` — if one exists, Deno will automatically use it for type +checking and the language server, no extra flags needed. Since Deno 2.1, +`jsconfig.json` is also auto-detected when a `package.json` is present, which +is useful for JavaScript-only projects. + +For example, an existing Node.js project with this `tsconfig.json`: + +```json title="tsconfig.json" +{ + "compilerOptions": { + "strict": true, + "jsx": "react-jsx", + "lib": ["dom", "esnext"], + "paths": { + "@/*": ["./src/*"] + } + }, + "include": ["src/**/*"] +} +``` + +will be picked up automatically when running `deno check` or using the Deno +language server. If a `deno.json` with its own `compilerOptions` is added +later, those take precedence. + +:::tip + +For Deno-first projects, prefer `compilerOptions` in `deno.json` over a +separate `tsconfig.json`. See +[Configuring TypeScript](/runtime/reference/ts_config_migration/) for the full +list of supported fields, precedence rules, and compiler option defaults. + +::: + ## Augmenting global types Deno supports ambient or global types in TypeScript. This is useful when From 243a25516c066651c22600212dc4812c36552996 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Thu, 21 May 2026 12:44:51 +0200 Subject: [PATCH 2/2] deno fmt --- runtime/fundamentals/typescript.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/runtime/fundamentals/typescript.md b/runtime/fundamentals/typescript.md index 27256690f..bd2a50350 100644 --- a/runtime/fundamentals/typescript.md +++ b/runtime/fundamentals/typescript.md @@ -268,12 +268,12 @@ To specify the library files to use in a TypeScript file, you can use While Deno uses `deno.json` for TypeScript configuration by default, it also supports `tsconfig.json` for compatibility with existing Node.js and TypeScript -projects, making it easier to adopt Deno incrementally. Each workspace -directory containing a `deno.json` or `package.json` is probed for a -`tsconfig.json` — if one exists, Deno will automatically use it for type -checking and the language server, no extra flags needed. Since Deno 2.1, -`jsconfig.json` is also auto-detected when a `package.json` is present, which -is useful for JavaScript-only projects. +projects, making it easier to adopt Deno incrementally. Each workspace directory +containing a `deno.json` or `package.json` is probed for a `tsconfig.json` — if +one exists, Deno will automatically use it for type checking and the language +server, no extra flags needed. Since Deno 2.1, `jsconfig.json` is also +auto-detected when a `package.json` is present, which is useful for +JavaScript-only projects. For example, an existing Node.js project with this `tsconfig.json`: @@ -292,13 +292,13 @@ For example, an existing Node.js project with this `tsconfig.json`: ``` will be picked up automatically when running `deno check` or using the Deno -language server. If a `deno.json` with its own `compilerOptions` is added -later, those take precedence. +language server. If a `deno.json` with its own `compilerOptions` is added later, +those take precedence. :::tip -For Deno-first projects, prefer `compilerOptions` in `deno.json` over a -separate `tsconfig.json`. See +For Deno-first projects, prefer `compilerOptions` in `deno.json` over a separate +`tsconfig.json`. See [Configuring TypeScript](/runtime/reference/ts_config_migration/) for the full list of supported fields, precedence rules, and compiler option defaults.