Skip to content

Commit

Permalink
fix(types): export Api (#740)
Browse files Browse the repository at this point in the history
This resolves issues in consumers of this package getting errors from TypeScript

```
The inferred type of 'Octokit' cannot be named without a reference to '../node_modules/@octokit/plugin-rest-endpoint-methods/dist-types/types.js'. This is likely not portable. A type annotation is necessary.
```
  • Loading branch information
wolfy1339 authored Apr 30, 2024
1 parent 3263f2d commit 703ebf8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ import { VERSION } from "./version.js";
import type { Api } from "./types.js";
import { endpointsToMethods } from "./endpoints-to-methods.js";

// Export the type for downstream users in order to fix a TypeScript error
// The inferred type of 'Octokit' cannot be named without a reference to '../node_modules/@octokit/plugin-rest-endpoint-methods/dist-types/types.js'. This is likely not portable. A type annotation is necessary.
export type { Api };

export function restEndpointMethods(octokit: Octokit): Api {
const api = endpointsToMethods(octokit);
return {
Expand Down

0 comments on commit 703ebf8

Please sign in to comment.