The `chrome-types` package provides official TypeScript declaration files for Chrome Extensions, automatically generated from the Chromium source code. This ensures the definitions are highly accurate and consistently up-to-date with the latest Chrome API changes. Published daily via GitHub Actions, the package reflects Chrome's HEAD revision, making it the most current source for Chrome extension types. It is currently at version 0.1.425. The default `index.d.ts` file includes only Manifest V3 (MV3) and newer types, while a separate `_all.d.ts` file is available for projects requiring definitions for deprecated Platform Apps APIs. This package is crucial for developers building Chrome extensions with TypeScript, providing robust type safety and autocompletion for the global `chrome` object and its various namespaces, distinguishing itself from community-maintained alternatives like `@types/chrome` by its direct origin from the Chromium project itself.
npm install chrome-typesVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to configure `tsconfig.json` to enable `chrome-types` and shows a basic Chrome extension background script utilizing `chrome.runtime`, `chrome.storage`, `chrome.action`, and `chrome.scripting` APIs with full TypeScript support.
If your project requires types for deprecated APIs, explicitly include `chrome-types/lib/_all.d.ts` using `/// <reference types="chrome-types/lib/_all" />` in your TypeScript files or configure `tsconfig.json` appropriately.
Prefer `chrome-types` for Chrome extension development with TypeScript due to its official origin and automated updates. Remove `@types/chrome` if present to avoid conflicts.
While `chrome-types` generally tracks current Chrome versions closely, be aware of potential discrepancies. For critical projects, cross-reference API usage with the official Chrome Extensions documentation for your target browser version. Consider pinning `chrome-types` to a specific version if strict API stability is required.
Ensure `chrome-types` is installed (`npm install --save-dev chrome-types`) and correctly configured in your `tsconfig.json` under `compilerOptions.types` or `compilerOptions.typeRoots`.
Verify that the API you are using is compatible with Manifest V3. If you intend to use deprecated APIs, ensure you are loading the `_all.d.ts` definition file: `/// <reference types="chrome-types/lib/_all" />`.
Review the specific type error message. Consult the official Chrome Extensions documentation for the correct API signature. Update your code to match the expected types, or consider narrowing types if the API has become more specific.
No dependency data recorded yet.