sinon-chrome icon indicating copy to clipboard operation
sinon-chrome copied to clipboard

Types and Properties Missing in @types/sinon-chrome?

Open Bartleby2718 opened this issue 5 years ago • 3 comments

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:

  1. Should I create a pull request in DefinitelyTyped/DefinitelyTyped, or will the maintainers of sinon-chrome take are of it?
  2. If I can create a pull request, is it okay to copy and paste from @types/chrome?
  3. 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?

Bartleby2718 avatar Jul 18 '19 13:07 Bartleby2718

It seems that web-ext-types has the definitions you want.

ariasuni avatar Oct 01 '19 22:10 ariasuni

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 avatar Dec 12 '23 19:12 Fiattarone

@Fiattarone I haven't worked on this for a long time, but have you tried global.chrome = require('sinon-chrome');?

Bartleby2718 avatar Feb 25 '24 18:02 Bartleby2718