Skip to content
Script to generate TypeScript definitions for WebExtension Development in FireFox
Branch: master
Clone or download
Pull request Compare This branch is even with jsmnbom:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

DefinitelyTyped Firefox WebExt Browser

Script to generate type definitions for WebExtension Development in FireFox.

See the output at: DefinitelyTyped/DefinitelyTyped/types/firefox-webext-browser.

Install definitions using npm install @types/firefox-webext-browser.

Currently based on FIREFOX_67_0b7_RELEASE.


You should only need to do this if you wanna update the definitions, to just use them, see the npm install line above.

Install dependencies

$ npm install

Build typescript files. Either just once, or optionally watch for files changes. (execute only one of below commands)

$ npm run once
$ npm run watch

Download proper firefox sources to firefox/VERISION. See for available tags.

$ node build/download.js -t <TAG> -v <VERSION> -o <OUTDIR>
$ node build/download.js -t FIREFOX_63_0b6_RELEASE -v 63.0b6 -o firefox

Then actually generate definitions

$ node build/index.js -f <FIREFOX VERSION> -s <SCHEMAS1> -s <SCHEMAS2> -o <OUTPUT_FILE>
$ node build/index.js -f 63.0 -s firefox/63.0b6/toolkit/components/extensions/schemas -s firefox/63.0b6/browser/components/extensions/schemas -o index.d.ts

And place the generated index.d.ts in DefinitelyTyped/DefinitelyTyped/types/firefox-webext-browser.

Note that for sending PRs to DefinitelyTyped you need to include why you changed. For simple updates (FF version changes), this can be easily generated and uploaded to gist using for example:

diff -uNr firefox/63.0b6 firefox/64.0b10 | gist -p -d "Diff of {toolkit,browser}/components/extensions/schemas/*.* in firefox source code, from version 63.0b6 to 64.0b10. Downloaded from" -f "63.0b6-to-64.0b10.diff"
You can’t perform that action at this time.