{"id":14995,"library":"typescript-auto-import-cache","title":"TypeScript Auto-Import Cache","description":"typescript-auto-import-cache is a utility package within the Volar.js ecosystem, currently at version 0.3.6, designed to address the performance bottleneck in the TypeScript Language Service Completion API, specifically when calculating auto-imports. It achieves this by porting and optimizing the `tsserver`'s internal auto-import caching logic. This package functions as a TypeScript Language Service Plugin, meaning it extends the functionality of the TypeScript language server (`tsserver`) to enhance the developer experience in IDEs (like VS Code) by speeding up IntelliSense for auto-imports. It is primarily a tooling-oriented package, not intended for direct runtime use in application code, and typically sees updates aligned with new TypeScript versions or Volar.js releases that may impact language service performance. Its key differentiator is its focused approach to optimizing a common pain point in large TypeScript projects, directly integrating with the underlying language service architecture.","status":"active","version":"0.3.6","language":"javascript","source_language":"en","source_url":"https://github.com/volarjs/typescript-auto-import-cache","tags":["javascript","typescript"],"install":[{"cmd":"npm install typescript-auto-import-cache","lang":"bash","label":"npm"},{"cmd":"yarn add typescript-auto-import-cache","lang":"bash","label":"yarn"},{"cmd":"pnpm add typescript-auto-import-cache","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required as a peer dependency for TypeScript Language Service Plugins to ensure compatibility with the `tsserver` version being used by the editor.","package":"typescript","optional":false}],"imports":[{"note":"typescript-auto-import-cache is a TypeScript Language Service Plugin. Its exports are consumed by the TypeScript language server itself (tsserver), not by typical application code. Developers enable it by referencing its package name in the `plugins` array within `tsconfig.json`. Attempts to `import` or `require` it directly into your own source files for runtime execution will not yield the intended results, as its functionality is specific to the IDE's language features.","wrong":"import { enableAutoImportCache } from 'typescript-auto-import-cache'; // Incorrect usage in application code.\nconst plugin = require('typescript-auto-import-cache'); // Incorrect CommonJS require for direct use.","symbol":"TypeScript Language Service Plugin","correct":"This package is not imported directly into user application code. It's configured via `tsconfig.json` as a plugin."}],"quickstart":{"code":"{ \n  \"compilerOptions\": {\n    \"plugins\": [\n      {\n        \"name\": \"typescript-auto-import-cache\"\n      }\n    ],\n    \"target\": \"es2020\",\n    \"module\": \"esnext\",\n    \"lib\": [\"es2020\", \"dom\"],\n    \"jsx\": \"react-jsx\",\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"skipLibCheck\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"moduleResolution\": \"bundler\",\n    \"resolveJsonModule\": true,\n    \"isolatedModules\": true,\n    \"noEmit\": true,\n    \"allowJs\": true\n  },\n  \"include\": [\"src\"],\n  \"references\": [{ \"path\": \"./tsconfig.node.json\" }]\n}","lang":"json","description":"This `tsconfig.json` configuration snippet demonstrates how to enable the `typescript-auto-import-cache` as a plugin for the TypeScript Language Service."},"warnings":[{"fix":"Always review the package's GitHub repository or `CHANGELOG.md` for specific migration steps when updating minor or patch versions of `0.x` releases.","message":"As a `0.x.y` version package, `typescript-auto-import-cache` may introduce breaking changes without adhering to semantic versioning for major versions. Updates should be tested carefully.","severity":"breaking","affected_versions":">=0.1.0"},{"fix":"Ensure your editor is using the workspace version of TypeScript (e.g., via `\"typescript.tsdk\": \"node_modules/typescript/lib\"` in VS Code settings). Consult plugin documentation for any specific TypeScript version requirements.","message":"Language Service Plugins are sensitive to the TypeScript version used by your editor/IDE. Incompatibility between the plugin's expected TypeScript version and the project's or editor's TypeScript version can lead to the plugin failing to load or unexpected behavior.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Do not expect changes in build times or application execution. If you observe no IDE performance improvement, verify the plugin is correctly loaded and there aren't other performance bottlenecks in your project configuration or editor setup. Check TypeScript server logs for plugin load status.","message":"This package is a performance optimization for the TypeScript Language Service (tsserver), meaning its impact is primarily on IDE responsiveness for auto-imports, not on the `tsc` compilation speed or runtime performance of your application.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Double-check the `name` property in `compilerOptions.plugins`. Enable verbose TypeScript server logging in your editor (e.g., `\"typescript.tsserver.log\": \"verbose\"` in VS Code) to diagnose plugin loading issues.","message":"Incorrect `tsconfig.json` paths or plugin configuration (e.g., typos in the plugin name) will cause the plugin to not load silently or with generic errors in the TypeScript server logs, leading to no performance benefits.","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Ensure your project's `typescript` dependency is compatible with the `typescript-auto-import-cache` plugin. Try updating `typescript-auto-import-cache` to the latest version. Check editor settings to confirm the workspace TypeScript version is being used. Refer to the plugin's GitHub issues for known compatibility problems.","cause":"The plugin's factory function either threw an error during initialization or returned an invalid object that didn't conform to the Language Service Plugin interface, often due to an incompatible TypeScript version or internal plugin issue.","error":"Plugin 'typescript-auto-import-cache' failed to load. Its 'create' function did not return a language service."},{"fix":"Run `npm install typescript-auto-import-cache` or `yarn add typescript-auto-import-cache`. Ensure your editor is configured to use the workspace TypeScript version, which will instruct `tsserver` to look in your project's `node_modules` for plugins.","cause":"The TypeScript language server (tsserver) could not locate the `typescript-auto-import-cache` package in `node_modules`. This typically happens if the package isn't installed or if `tsserver` is resolving modules from an unexpected location.","error":"Error: Cannot find module 'typescript-auto-import-cache' from '.../tsserver'"}],"ecosystem":"npm"}