definitelytyped-firefox-webext-browser
definitelytyped-firefox-webext-browser copied to clipboard
`browser.identity.getAuthToken` resolves with `AccountInfo[]` instead of string
This is a Chrome-only API: https://developer.chrome.com/docs/extensions/reference/identity/#method-getAuthToken
Currently mistyped as
/**
* Gets an OAuth2 access token using the client ID and scopes specified in the oauth2 section of manifest.json.
* @deprecated Unsupported on Firefox at this time.
*/
function getAuthToken(details?: _GetAuthTokenDetails): Promise<AccountInfo[]>;
It should be:
function getAuthToken(details?: _GetAuthTokenDetails): Promise<string>;
Yep, i see. Should be fixed when https://github.com/DefinitelyTyped/DefinitelyTyped/pull/54359 merges ^^
Oh nevermind, i misunderstood, gimme a sec.
Hmm... not totally sure how to handle this one, since according to https://developer.chrome.com/docs/extensions/reference/identity/#method-getAuthToken, it can return two values?
Promise<string, string>, would be ideal, but that's obviously not possible...
Should i just leave it as Promise
Indeed, perhaps it should just be removed for the time being because it's not part of the browser.* API
I moved to @types/chrome and @types/webextensions-polyfill