Skip to content

Commit

Permalink
fix(usage): add chrome namespace to Window and add usage directio…
Browse files Browse the repository at this point in the history
…ns, fixes #17
  • Loading branch information
MichaelSolati committed Mar 2, 2022
1 parent dfe80f3 commit b93130d
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 1 deletion.
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`

This comment has been minimized.

Copy link
@GABBER202025

GABBER202025 Jun 11, 2023

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"
]
}

0 comments on commit b93130d

Please sign in to comment.