docs: Add TypeScript Usage Hints

This commit is contained in:
Lusito 2020-06-25 14:23:44 +02:00 committed by Rob Wu
parent d6a789bf54
commit b0596ad616
1 changed files with 11 additions and 0 deletions

View File

@ -20,6 +20,7 @@ Table of contents
* [Usage with webpack without bundling](#usage-with-webpack-without-bundling) * [Usage with webpack without bundling](#usage-with-webpack-without-bundling)
* [Using the Promise-based APIs](#using-the-promise-based-apis) * [Using the Promise-based APIs](#using-the-promise-based-apis)
* [Examples](#examples) * [Examples](#examples)
* [Usage with TypeScript](#usage-with-typescript)
* [Known Limitations and Incompatibilities](#known-limitations-and-incompatibilities) * [Known Limitations and Incompatibilities](#known-limitations-and-incompatibilities)
* [Contributing to this project](#contributing-to-this-project) * [Contributing to this project](#contributing-to-this-project)
@ -324,6 +325,16 @@ browser.runtime.onMessage.addListener(async function(msg) {
Or vice versa. Or vice versa.
## Usage with TypeScript
There are multiple projects that add TypeScript support to your web-extension project:
| Project | Description |
| ------------- | ------------- |
| [webextension-polyfill-ts](https://github.com/Lusito/webextension-polyfill-ts) | Types and JS-Doc are automatically generated from the mozilla schema files, so it is always up-to-date with the latest APIs. It also bundles the webextension-polyfill for very simple usage. |
| [web-ext-types](https://github.com/kelseasy/web-ext-types) | Manually maintained types based on MDN's documentation. No JS-Doc included. |
| [@types/chrome](https://www.npmjs.com/package/@types/chrome) | Manually maintained types and JS-Doc. Only contains types for chrome extensions though! |
## Known Limitations and Incompatibilities ## Known Limitations and Incompatibilities
This library tries to minimize the amount of "special handling" that a cross-browser extension has to do to be able to run on the supported browsers from a single codebase, but there are still cases when polyfillling the missing or incompatible behaviors or features is not possible or out of the scope of this polyfill. This library tries to minimize the amount of "special handling" that a cross-browser extension has to do to be able to run on the supported browsers from a single codebase, but there are still cases when polyfillling the missing or incompatible behaviors or features is not possible or out of the scope of this polyfill.