forked from GoogleChrome/chrome-types
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(usage): add
chrome
namespace to Window
and add usage directio…
…ns, fixes GoogleChrome#17
- Loading branch information
1 parent
dfe80f3
commit b93130d
Showing
4 changed files
with
38 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ chrome-*.json | |
.DS_Store | ||
node_modules/ | ||
dist/*.d.ts | ||
!dist/global.d.ts | ||
dist/package.json | ||
.cache/ | ||
coverage/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters