File tree Expand file tree Collapse file tree 1 file changed +11
-12
lines changed Expand file tree Collapse file tree 1 file changed +11
-12
lines changed Original file line number Diff line number Diff line change @@ -5,16 +5,15 @@ import { restEndpointMethods } from "@octokit/plugin-rest-endpoint-methods";
5
5
6
6
import { VERSION } from "./version" ;
7
7
8
- export const Octokit = Core
9
- // TODO: this really should be
8
+ export const Octokit = Core . plugin ( [
9
+ // Workaround to prevent TypeScript from widening the inferred return type of
10
+ // plugins passed to Octokit, which would result in type information (e.g.
11
+ // methods provided by plugins) not being added to Octokit instances.
10
12
//
11
- // .plugin([requestLog, paginateRest, restEndpointMethods])
12
- //
13
- // but for mystical reasons, using the line above does set the resulting the
14
- // `octokit` instance type correctly. Neither `octokit.paginate()` nor all the
15
- // endpoint methods such as `octokit.repos.get() are set
16
- . plugin ( requestLog )
17
- . plugin ( [ paginateRest , restEndpointMethods ] )
18
- . defaults ( {
19
- userAgent : `octokit-rest.js/${ VERSION } `
20
- } ) ;
13
+ // See https://github.com/octokit/core.js/issues/51#issuecomment-596846088
14
+ ( requestLog as unknown ) as ( ) => void ,
15
+ restEndpointMethods ,
16
+ paginateRest
17
+ ] ) . defaults ( {
18
+ userAgent : `octokit-rest.js/${ VERSION } `
19
+ } ) ;
You can’t perform that action at this time.
0 commit comments