[BUG]: '"@octokit/graphql-schema"' not exporting schema types, TS compilation fails
What happened?
Starting from @octokit/graphql-schema v15.4.2, importing the Commit type as indicated in Schema as Types in README fails TypeScript compilation (using ts-node) with the error '"@octokit/graphql-schema"' has no exported member 'Commit'.
The type is imported with the following statement:
import { Commit } from "@octokit/graphql-schema";
Autocompletion in my IDE suggests to import the type like presented above.
Versions
The issue occurs on @octokit/graphql-schema starting from v15.4.2 onwards.
The issue is not present v15.4.1 and earlier versions.
https://github.com/octokit/graphql-schema/compare/v15.4.1...v15.4.2
The failing script uses ts-node version 10.8.1.
Relevant log output
/<REDACTED>/node_modules/ts-node/src/index.ts:843
return new TSError(diagnosticText, diagnosticCodes, diagnostics);
^
TSError: ⨯ Unable to compile TypeScript:
REDACTED.ts - error TS2305: Module '"@octokit/graphql-schema"' has no exported member 'Commit'.
19 import { Commit } from "@octokit/graphql-schema";
~~~~~~
at createTSError (/<REDACTED>/node_modules/ts-node/src/index.ts:843:12)
at reportTSError (/<REDACTED>/node_modules/ts-node/src/index.ts:847:19)
at getOutput (/<REDACTED>/node_modules/ts-node/src/index.ts:1057:36)
at Object.compile (/<REDACTED>/node_modules/ts-node/src/index.ts:1411:41)
at Module.m._compile (/<REDACTED>/node_modules/ts-node/src/index.ts:1596:30)
at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
at Object.require.extensions.<computed> [as .ts] (/<REDACTED>/node_modules/ts-node/src/index.ts:1600:12)
at Module.load (node:internal/modules/cjs/loader:1208:32)
at Function.Module._load (node:internal/modules/cjs/loader:1024:12)
at Module.require (node:internal/modules/cjs/loader:1233:19) {
diagnosticCodes: [ 2305 ]
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Code of Conduct
- [X] I agree to follow this project's Code of Conduct
👋 Hi! Thank you for this contribution! Just to let you know, our GitHub SDK team does a round of issue and PR reviews twice a week, every Monday and Friday! We have a process in place for prioritizing and responding to your input. Because you are a part of this community please feel free to comment, add to, or pick up any issues/PRs that are labeled with Status: Up for grabs. You & others like you are the reason all of this works! So thank you & happy coding! 🚀
What does your tsconfig look like?
@EPMatt Hi, I personally don't use ts-node. However, the example repository looks like it's working.
Could you check https://github.com/kachick/example-octokit-graphql-schema-968 and the GitHub action result?
https://github.com/kachick/example-octokit-graphql-schema-968/actions/runs/12499600836/job/34874808718
tested dependencies and the configuration is written in https://github.com/kachick/example-octokit-graphql-schema-968/blob/1fe078800de8fba0e38c751807bf8e9b046c6ad3/package.json#L2-L9
And I ran ts-node with node --loader ts-node/esm --no-warnings=ExperimentalWarning example.ts
Pinned with ts-node 10.8.1 and octokit/graphql-schema v15.4.2
https://github.com/kachick/example-octokit-graphql-schema-968/blob/5638d82b0abc51e40af8a25c4229506d756bb5ea/package.json#L1-L10
https://github.com/kachick/example-octokit-graphql-schema-968/actions/runs/12499807260/job/34875251485
Closing due to the lack of response, and being unable to reproduce