Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions runtime/fundamentals/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,49 @@ Deno uses lockfile by default, you can disable it with following configuration:
}
```

## Minimum dependency age

:::caution Unstable feature

This feature is unstable and requires the `--unstable-npm-lazy-caching` flag or
can be configured directly in `deno.json`.

:::

The `minimumDependencyAge` field specifies the minimum age a dependency must have
before Deno will install it. This is a supply chain security measure that
protects against recently published malicious packages by ensuring only
dependencies that have existed for a specified period are allowed.

The value can be specified as a number of minutes, an
[ISO 8601 duration](https://en.wikipedia.org/wiki/ISO_8601#Durations), or an
[RFC 3339](https://datatracker.ietf.org/doc/html/rfc3339) timestamp:

```json title="deno.json"
{
// Number of minutes (e.g. 120 = 2 hours)
"minimumDependencyAge": 120
}
```

```json title="deno.json"
{
// ISO 8601 duration (e.g. P2D = 2 days)
"minimumDependencyAge": "P2D"
}
```

```json title="deno.json"
{
// RFC 3339 absolute cutoff date
"minimumDependencyAge": "2025-09-16"
}
```

This setting can be overridden on the command line with
`--minimum-dependency-age=<value>`, or disabled with
`--minimum-dependency-age=0`.

## Node modules directory

By default Deno uses a local `node_modules` directory if you have a
Expand Down
81 changes: 81 additions & 0 deletions runtime/fundamentals/typescript.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,87 @@ To specify the library files to use in a TypeScript file, you can use
/// <reference lib="dom" />
```

## Configuring TypeScript with `tsconfig.json` {#tsconfig}

While Deno uses `deno.json` for TypeScript configuration by default, it also
supports `tsconfig.json` files for compatibility with existing Node.js and
TypeScript projects. This makes it easier to adopt Deno incrementally without
rewriting your TypeScript configuration.

### Auto-detection

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` files are also auto-detected when a
`package.json` is present. This is useful for JavaScript-only projects that rely
on `jsconfig.json` for editor and type-checking configuration.

### Supported fields

Deno supports the following `tsconfig.json` fields:

```json title="tsconfig.json"
{
"extends": "...",
"files": ["..."],
"include": ["..."],
"exclude": ["..."],
"references": [
{ "path": "..." }
],
"compilerOptions": {
"...": "..."
}
}
```

Except for `compilerOptions`, these fields (`files`, `include`, `exclude`,
`references`, `extends`) cannot be specified in `deno.json`, so you may need a
`tsconfig.json` when you require that level of granularity.

### Precedence rules

When both `deno.json` and `tsconfig.json` are present, the following precedence
rules apply:

- A parent `deno.json` with `compilerOptions` takes precedence over any
`tsconfig.json`.
- Among tsconfig references, a more specific path (e.g., `foo/bar/tsconfig.json`)
takes precedence over a less specific one (e.g., `foo/tsconfig.json`).

### Example: Using an existing `tsconfig.json`

If you have a Node.js project with a `tsconfig.json`:

```json title="tsconfig.json"
{
"compilerOptions": {
"strict": true,
"jsx": "react-jsx",
"lib": ["dom", "esnext"],
"paths": {
"@/*": ["./src/*"]
}
},
"include": ["src/**/*"]
}
```

Deno will automatically pick up this configuration when running `deno check` or
using the Deno language server — no `deno.json` needed. If you later add a
`deno.json` with its own `compilerOptions`, those will take precedence.

:::tip

For Deno-first projects, it's recommended to use the `compilerOptions` field in
`deno.json` instead of a separate `tsconfig.json`. See the
[configuring TypeScript](/runtime/reference/ts_config_migration/) reference for a
full list of supported compiler options and their defaults.

:::

## Augmenting global types

Deno supports ambient or global types in TypeScript. This is useful when
Expand Down
Loading