sinon-chrome
sinon-chrome copied to clipboard
Types and Properties Missing in @types/sinon-chrome?
I'm not sure if this is the right place to ask, but here we go.
I recently created a Chrome extension using TypeScript and decided to add some test codes using Jest. Then I found a StackOverflow answer that led me to this repository.
Because my project uses TypeScript, I needed to install @types/sinon-chrome to get it working. However, unlike @types/chrome, only methods
and events
are defined in @types/sinon-chrome. In other words, types
and properties
are not defined in @types/sinon-chrome. For example, chrome.bookmarks
API contains 2 types
, 2 properties
, 11 methods
, and 7 events
; @types/chrome has all of them, but types
and properties
are absent in @types/sinon-chrome.
I tried copy-and-pasting the code in @types/chrome to @types/sinon-chrome and it works like a charm. So my questions are as follows:
- Should I create a pull request in DefinitelyTyped/DefinitelyTyped, or will the maintainers of sinon-chrome take are of it?
- If I can create a pull request, is it okay to copy and paste from @types/chrome?
- If someone else is in charge of that, what can I do in the meantime? Should all of my coworkers manually copy and paste what is lacking in @types/sinon-chrome?
It seems that web-ext-types has the definitions you want.
For my use case, web-ext-types doesn't seem to have it... @ariasuni
After implementing web-ext-types, global.chrome = chrome still gives me:
Type 'typeof SinonChrome' is missing the following properties from type 'typeof chrome': cast, accessibilityFeatures, action, browser, and 26 more.ts(2740)
@Bartleby2718 , did you ever reach a resolution or is the solution to copy paste from @types/chrome?
@Fiattarone I haven't worked on this for a long time, but have you tried global.chrome = require('sinon-chrome');
?