Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type 'typeof import("...@octokit/rest/index") is not a constructor function type #2

Closed
nwtgck opened this issue Feb 4, 2020 · 2 comments

Comments

@nwtgck
Copy link
Owner

nwtgck commented Feb 4, 2020

This problem is only related to users deploying this repo.

Develop problem

Using npm run build, you will have the following error.

[actions-netlify]$ npm run build

> [email protected] build /...
> tsc

node_modules/@actions/github/lib/github.d.ts:5:37 - error TS2507: Type 'typeof import("/.../node_modules/@octokit/rest/index")' is not a constructor function type.

5 export declare class GitHub extends Octokit {
                                      ~~~~~~~

node_modules/@actions/github/lib/github.d.ts:15:52 - error TS2694: Namespace '"/.../node_modules/@octokit/rest/index"' has no exported member 'Options'.

15     constructor(token: string, opts?: Omit<Octokit.Options, 'auth'>);
                                                      ~~~~~~~

node_modules/@actions/github/lib/github.d.ts:16:31 - error TS2694: Namespace '"/.../node_modules/@octokit/rest/index"' has no exported member 'Options'.

16     constructor(opts: Octokit.Options);
                                 ~~~~~~~

src/main.ts:33:26 - error TS2339: Property 'issues' does not exist on type 'GitHub'.

33       await githubClient.issues.createComment({
                            ~~~~~~


Found 4 errors.

Workaround

You can directly modify ./node_modules/@actions/github/lib/github.d.ts as follows.

- import Octokit from '@octokit/rest';
+ import {Octokit} from '@octokit/rest';
@nwtgck
Copy link
Owner Author

nwtgck commented Feb 5, 2020

This should be resolved by actions/toolkit#332.

@nwtgck
Copy link
Owner Author

nwtgck commented Feb 5, 2020

Solved by 245a3b6. The solution was from actions/toolkit#332 (comment). Thanks.

@nwtgck nwtgck closed this as completed Feb 5, 2020
nwtgck pushed a commit that referenced this issue Nov 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant