Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: guide user to enable libReplacement option #67

Merged
merged 1 commit into from
Mar 8, 2025
Merged
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
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,24 @@ npm i -D better-typescript-lib

[If you are using TypeScript 4.4 or prior, see the v1 branch.](https://github.com/uhyo/better-typescript-lib/tree/v1)

### Set `libReplacement: true`

If you are using **TypeScript 5.8 or later**, include the following setting in your `tsconfig.json`:

```json
{
"compilerOptions": {
// ...
"libReplacement": true
}
}
```

> [!NOTE]
> The `libReplacement` option is available from TypeScript 5.8. If you are using TypeScript 5.7 or earlier, better-typescript-lib will work by default.
>
> Technically this option is not required for the current version of TypeScript because the default value is `true`. It is recommended to include it for future compatibility. In the following versions of TypeScript (likely 6.0 or later), the default value may be changed to `false` and you will need to set it to `true`.

### How it works

Starting from TypeScript 4.5, the TypeScript compiler detects existence of `@typescript/lib-xxx` packages (e.g. `@typescript/lib-es2015`) and uses them instead of the built-in definitions. By installing `better-typescript-lib`, these package names are mapped to corresponding `@better-typescript-lib/xxx` packages.
Expand Down