Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Bartleby2718 opened this issue Jul 18, 2019 · 3 comments
Open

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

Bartleby2718 opened this issue Jul 18, 2019 · 3 comments

Comments

@Bartleby2718
Copy link

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?
@ariasuni
Copy link

ariasuni commented Oct 1, 2019

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

@Fiattarone
Copy link

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?

@Bartleby2718
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants