typescript-workspace-plugin is a language service plugin for TypeScript that adds robust support for monorepo setups, specifically those using Yarn-like workspaces. It allows individual packages within a workspace to maintain independent `tsconfig.json` files while enabling the TypeScript language service to correctly resolve local package sources, rather than relying solely on `node_modules` typings. This restores critical IDE features such as 'go to definition,' 'find references,' and accurate type checking across locally linked dependencies. The current stable version is 2.0.1. Its release cadence is irregular, driven by community needs and TypeScript updates. A key differentiator is its ability to maintain independent package configuration while ensuring full language service functionality within a monorepo, addressing a common pain point for developers working with interwoven local packages.
npm install typescript-workspace-pluginVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates the essential configuration for integrating the typescript-workspace-plugin into a monorepo. It shows how to add the plugin entry to individual package `tsconfig.json` files and define the `workspace-sources` mapping in the top-level `package.json` to enable correct language service resolution across workspace packages.
In VS Code, open the command palette (Cmd+Shift+P or Ctrl+Shift+P), type 'TypeScript: Select TypeScript Version...', and choose 'Use Workspace Version'. A reload of the editor might also be necessary.
Carefully review the glob patterns in `workspace-sources`. For example, if packages are in `libs/` and sources are in `src/`, use `"libs/*/src"`. Verify `package.json` structure.
Open the command palette (Ctrl+Shift+P or Cmd+Shift+P), search for 'TypeScript: Select TypeScript Version...', and select 'Use Workspace Version'. Restart the editor if necessary.
Verify that `typescript-workspace-plugin` is correctly listed in `tsconfig.json`'s `plugins` array. Check the `workspace-sources` glob patterns in your top-level `package.json` to ensure they point to the correct source directories of your workspace packages. Also, confirm you are using the workspace TypeScript version in your editor.