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

Add instructions for using this library

Open vjpr opened this issue 3 years ago • 3 comments

I am not clear on how best to use this library. Do I need to make tsconfig.json changes? Or ///reference..

Do I use "typeRoots": ["./node_modules/@types", "./node_modules/chrome-types"]?

vjpr avatar Oct 15 '21 00:10 vjpr

@vjpr what I did was creating a chrome.d.ts file inside my types folder and added this as its content:

/// <reference types="chrome-types" />

declare global {
  interface Window {
    chrome: chrome;
  }
}

not really sure if that's the correct way to do it, but it's working. Hope this helps!

piedrahitapablo avatar Nov 30 '21 17:11 piedrahitapablo

For now I'm using it like this, I'm not a fan of referencing from global scope

globalThis is for MV3 because SW

I had to use patch-package

SCR-20220729-h67

olso-nordsec avatar Jul 29 '22 10:07 olso-nordsec

This is funny, an awesome library, but the usage section doesn't document how to use it :P

Made this PR — https://github.com/GoogleChrome/chrome-types/pull/39 hope it helps!

tusharmath avatar Nov 04 '22 07:11 tusharmath