# Source: https://oxc.rs/docs/guide/usage/linter/rules/typescript/triple-slash-reference.md

## What it does

Disallow certain triple slash directives in favor of ES module import declarations.

## Why is this bad?

Use of triple-slash reference type directives is generally discouraged in favor of ECMAScript Module imports.

## Examples

Examples of **incorrect** code for this rule:

```ts
/// <reference lib="code" />
globalThis.value;
```

## Configuration

This rule accepts a configuration object with the following properties:

## lib

type: `"always" | "never"`

default: `"always"`

What to enforce for `/// <reference lib="..." />` references.

### `"always"`

Allow triple-slash `lib` references.

### `"never"`

Disallow triple-slash `lib` references.

## path

type: `"always" | "never"`

default: `"never"`

What to enforce for `/// <reference path="..." />` references.

### `"always"`

Allow triple-slash `path` references.

### `"never"`

Disallow triple-slash `path` references.

## types

type: `"always" | "never" | "prefer-import"`

default: `"prefer-import"`

What to enforce for `/// <reference types="..." />` references.

### `"always"`

Allow triple-slash `types` references.

### `"never"`

Disallow triple-slash `types` references.

### `"prefer-import"`

Prefer ES module import declarations over triple-slash `types` references.
This option only reports when there is an existing `import` declaration for the same module.

For example, this would be reported as a lint violation with `prefer-import`:

```ts
/// <reference types="foo" />
import { bar } from "foo";
```

## How to use

To **enable** this rule using the config file or in the CLI, you can use:

::: code-group

```json [Config (.oxlintrc.json)]
{
  "rules": {
    "typescript/triple-slash-reference": "error"
  }
}
```

```bash [CLI]
oxlint --deny typescript/triple-slash-reference
```

:::

## References

* Rule Source