From 703ebf8efa9681bdc7bee548eb0f3b95faa6cab7 Mon Sep 17 00:00:00 2001 From: wolfy1339 <4595477+wolfy1339@users.noreply.github.com> Date: Tue, 30 Apr 2024 15:16:17 -0400 Subject: [PATCH] fix(types): export `Api` (#740) 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. ``` --- src/index.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/index.ts b/src/index.ts index ef9cb65c7..34669af5f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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 {