Describe the bug
The shipped github.d.ts file contains errors. The originating code is here: https://github.com/actions/toolkit/blob/master/packages/github/src/github.ts
To Reproduce
Steps to reproduce the behavior:
npm init -y
tsc --init
- Add
a.ts:
import * as x from "@actions/github"
tsc
Result:
node_modules/@actions/github/lib/github.d.ts:1:49 - error TS7016: Could not find a declaration file for module '@octokit/graphql'. 'D:/Throwaway/IssuesTest/node_modules/@octokit/graphql/index.js' implicitly has an 'any' type.
Try `npm install @types/octokit__graphql` if it exists or add a new declaration (.d.ts) file containing `declare module '@octokit/graphql';`
1 import { GraphQlQueryResponse, Variables } from '@octokit/graphql';
~~~~~~~~~~~~~~~~~~
Expected behavior
There shouldn't be errors
Screenshots
Desktop (please complete the following information):
Additional context
This is a very confusing error because the next logical step for a developer would be to npm install @octokit/graphql, but if you do this, it just changes the error:
node_modules/@actions/github/lib/github.d.ts:1:10 - error TS2305: Module '"../../../../../../Throwaway/IssuesTest/node_modules/@octokit/graphql/dist-types"' has no exported member 'GraphQlQueryResponse'.
1 import { GraphQlQueryResponse, Variables } from '@octokit/graphql';
~~~~~~~~~~~~~~~~~~~~
node_modules/@actions/github/lib/github.d.ts:1:32 - error TS2305: Module '"../../../../../../Throwaway/IssuesTest/node_modules/@octokit/graphql/dist-types"' has no exported member 'Variables'.
1 import { GraphQlQueryResponse, Variables } from '@octokit/graphql';
~~~~~~~~~
It wasn't clear to me why the .ts file loads the checked-in .d.ts instead of just pulling in the real @octokit/grapqhl module? This pattern is guaranteed to break for .d.ts emit unless some other source of type data provides a definition for the module.
Two possible fixes:
Either way the import needs to be updated
Describe the bug
The shipped
github.d.tsfile contains errors. The originating code is here: https://github.com/actions/toolkit/blob/master/packages/github/src/github.tsTo Reproduce
Steps to reproduce the behavior:
npm init -ytsc --inita.ts:tscResult:
Expected behavior
There shouldn't be errors
Screenshots
Desktop (please complete the following information):
Additional context
This is a very confusing error because the next logical step for a developer would be to
npm install @octokit/graphql, but if you do this, it just changes the error:It wasn't clear to me why the
.tsfile loads the checked-in.d.tsinstead of just pulling in the real@octokit/grapqhlmodule? This pattern is guaranteed to break for.d.tsemit unless some other source of type data provides a definition for the module.Two possible fixes:
@octokit/graphqldefinition@actions/github->@octokit/graphqlEither way the import needs to be updated