-
Notifications
You must be signed in to change notification settings - Fork 27
Closed
Labels
Status: Up for grabsIssues that are ready to be worked on by anyoneIssues that are ready to be worked on by anyoneType: BugSomething isn't working as documentedSomething isn't working as documentedreleasedtypescriptRelevant to TypeScript users onlyRelevant to TypeScript users only
Description
What happened?
import { Octokit, OAuthApp } from 'octokit'
const app = new OAuthApp({
clientType: 'oauth-app',
clientId: 'fakeClientId',
clientSecret: 'fakeClientSecret',
})
const octokit: Octokit = await app.getUserOctokit({ code: 'fakeCode' })causes a type error in the last line, because the unwrapped return value of app.getUserOctokit is not assignable to the constant of type Octokit.
What did you expect to happen?
No type errors.
What the problem might be
app.getUserOctokit returns a promise of an instance type of Octokit option.
However, app.getUserOctokit is declared as returning Promise<OctokitInstance>, where OctokitInstance is hardcoded to be an instance type of OAuthTypeOctokit, regardless of the options passed to OAuthApp constructor.
It should probably be declared as returning Promise<OctokitTypeFromOptions<TOptions>> instead.
A similar issue (but about octokit field instead of getUserOctokit method) is #212.
oleksiipiliugin
Metadata
Metadata
Assignees
Labels
Status: Up for grabsIssues that are ready to be worked on by anyoneIssues that are ready to be worked on by anyoneType: BugSomething isn't working as documentedSomething isn't working as documentedreleasedtypescriptRelevant to TypeScript users onlyRelevant to TypeScript users only