definitelytyped-firefox-webext-browser
definitelytyped-firefox-webext-browser copied to clipboard
Generating types for Thunderbird
Could this be used to generate types also for Thunderbird? I mean for the new WebExtension API in the new Thunderbird 78: https://webextension-api.thunderbird.net/en/78/index.html (it's mostly the same API but with some special namespaces for handling email related things)
Depends on if mozilla is using the same Chrome-ish format for their schema files. Not something I personally have an interest in tho, but I'll keep the issue open in case anyone is wondering the same.
The library @types/thunderbird-webext-browser is now in DefinitelyTyped and npm. I forked this project and adjusted it to the Thunderbird WebExtension API.
@jsmnbom most of my edits have to do with the specifics of Thunderbird's schemas, but perhaps some may be useful for your project (or perhaps not). Specifically:
- Dealing with optional parameters in functions. That often means adding 'overloads', and I changed the algorithm for the creation of the overloads so it creates the smallest number of them. This also avoids some linting errors of type
unified-signatures. My code is in the second half of theconvertFunctionmethod of theConverterclass. - Hard-wrapping long lines in comments. This is mostly aesthetic, but it avoids
max-line-lengthlinting errors. It's in the same source file: I first import a function from theprettierlibrary to do the wrapping, then use it in two places where comments are formatted. By the way, I also use it for the final output of the program. - Newlines in comments: to make sure
\n\nin a description is translated into a double newline in the comment (which means a new paragraph in the mouse-over description in an IDE), I added a line to thedescToMarkdownfunction. - I have nested the namespaces: instead of
declare namespace browser.accounts {...}anddeclare namespace browser.i18n {...}and so on, I havedeclare namespace browser {namespace accounts {...} namespace i18n {...} ...}. The reasons have to do with, among other things, the way Visual Studio Code creates the help descriptions that show on mouse-over of a namespace. See here for my findings on this. It is done with a few small changes in four places.
Other changes, like a more complicated download procedure, additional export keywords, and code to create a special version that works better in the WebStorm coding environment, are probably not very relevant for you.
Thank you Jim! I've just tested in my Darko and ScrollAnywhere addons for Thunderbird and it works great! Great job!
Gonna close this since @JimDanner 's fork fulfills this purpose ^^ https://github.com/JimDanner/definitelytyped-thunderbird-webext-browser
Thanks <3