Skip to content
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ chrome-*.json
.DS_Store
node_modules/
dist/*.d.ts
!dist/global.d.ts
dist/package.json
.cache/
coverage/
23 changes: 23 additions & 0 deletions dist/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
# chrome-types
Published TypeScript definition files for Chrome Extensions, automatically generated from Chromium source code.

The default types file "index.d.ts" contains MV3+ types only.

The helper "_all.d.ts" contains types including the deprecated Platform Apps APIs, and is used for the developer.chrome.com site.

## Set Up

To expose the global `chrome` namespace be sure to include `chrome-types` in your `tsconfig.json`. You could add `"chrome-types"` to the `compilerOptions.types` array, though you will then need to include each type definitions you want. It is recommended that you add `"node_modules/chrome-types/global.d.ts"` to the `include` array instead.

### `compilerOptions.types`

```JSON
{
"compilerOptions": {
"types": ["chrome-types"]
}
}
```

### `include`

```JSON
{
"include": ["node_modules/chrome-types/global.d.ts"]
}
```
8 changes: 8 additions & 0 deletions dist/global.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/// <reference name="chrome" types="./index" />

interface Window {
/**
* Global Chrome namespace generated from Chromium source code.
*/
chrome: typeof chrome;
}
7 changes: 6 additions & 1 deletion dist/package.template.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,10 @@
"bugs": {
"url": "https://github.com/GoogleChrome/chrome-types/issues"
},
"homepage": "https://github.com/GoogleChrome/chrome-types"
"homepage": "https://github.com/GoogleChrome/chrome-types",
"keywords": [
"chrome",
"chromium",
"types"
]
}