TypeScript Reference ยท tsconfig: Projects, Files and Watch Options
TypeScript plugins option
Reference for the TypeScript plugins compiler option: language service plugins that extend editors, how they are configured, and what tsc ignores.
plugins is a compilerOptions entry that lists language service plugins. A plugin is an npm package loaded by the editor's TypeScript server. It wraps the language service and can add completions, extra diagnostics, hover text, or understanding of other file formats (for example CSS modules, GraphQL strings, or component templates).
Plugins affect the editing experience only. The command-line compiler tsc does not load them, so they cannot change which errors appear in a build, and they do not change emitted code.
{ "compilerOptions": { "plugins": [ { "name": "typescript-plugin-css-modules" }, { "name": "my-lint-plugin", "level": "warning" } ] } }
Try it
A language service plugin decorates an existing service object. These examples show that decorating pattern, without needing an editor.
Press Run (or Ctrl + Enter) to see the result here.
Program input ยท what you'd type while the program runs
Type the answers before you press Run, one per line. Each time the program reads a line (with node:readline or readFileSync(0)), it gets the next line from this box.
Press Run (or Ctrl + Enter) to see the result here.
Program input ยท what you'd type while the program runs
Type the answers before you press Run, one per line. Each time the program reads a line (with node:readline or readFileSync(0)), it gets the next line from this box.
Syntax
{ "compilerOptions": { "plugins": [ { "name": "package-name", "anyOtherSetting": true } ] } }
| Property | Description |
|---|---|
name |
The package to load, resolved from the project's node_modules. Required. |
| any other key | Passed to the plugin as its configuration; each plugin documents its own. |
Edge cases: a plugin that is not installed is skipped silently in the editor; plugins must be installed in the workspace, not globally, and the editor must use the workspace TypeScript version for them to load.
Usage notes
- Editor only. Nothing here changes
tscoutput. For build-time checks use an ordinary lint step or a compiler transform tool. - Select the workspace TypeScript version in your editor, otherwise the bundled one runs and may not load plugins.
- Native compiler caveat. The TypeScript 7 native tooling has a different extension story from the JavaScript-based language server, and plugins written for the old API may not run there; check each plugin's documentation.
- Framework plugins (templates for Vue, Angular, Next.js and others) are the most common use; they typically need no settings besides
name. - Security. A plugin runs code inside your editor, so install only packages you trust.
- Debugging a plugin usually means reading the TypeScript server log.