Skip to content

Commit 21dc0d3

Browse files
committed
fix: remove obsolete TypeScript workaround
1 parent f531b3f commit 21dc0d3

File tree

1 file changed

+1
-37
lines changed

1 file changed

+1
-37
lines changed

src/index.ts

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -4,43 +4,7 @@ import { paginateRest } from "@octokit/plugin-paginate-rest";
44

55
import { VERSION } from "./version";
66

7-
const CoreWithPlugins = Core.plugin([paginateRest]);
8-
9-
// Workaround for TypeScript bug, see https://github.com/octokit/core.js#a-note-on-typescript
10-
import {
11-
OctokitOptions,
12-
OctokitPlugin,
13-
ReturnTypeOf,
14-
Constructor
15-
} from "@octokit/core";
16-
17-
/* istanbul ignore next */
18-
class CoreWithPluginsWorkaround extends CoreWithPlugins {
19-
static plugin<T extends OctokitPlugin | OctokitPlugin[]>(pluginOrPlugins: T) {
20-
const currentPlugins = this.plugins;
21-
const newPlugins = Array.isArray(pluginOrPlugins)
22-
? pluginOrPlugins
23-
: [pluginOrPlugins];
24-
25-
const NewOctokit = class extends this {
26-
static plugins = currentPlugins.concat(
27-
newPlugins.filter(plugin => !currentPlugins.includes(plugin))
28-
);
29-
};
30-
31-
return NewOctokit as typeof NewOctokit & Constructor<ReturnTypeOf<T>>;
32-
}
33-
34-
static defaults(defaults: OctokitOptions) {
35-
return class OctokitWithDefaults extends this {
36-
constructor(options: OctokitOptions = {}) {
37-
super(Object.assign({}, defaults, options));
38-
}
39-
};
40-
}
41-
}
42-
43-
export const Octokit = CoreWithPluginsWorkaround.defaults({
7+
export const Octokit = Core.plugin([paginateRest]).defaults({
448
authStrategy: createActionAuth,
459
userAgent: `octokit-action.js/${VERSION}`
4610
});

0 commit comments

Comments
 (0)