octokit / graphql-schema

GitHub’s GraphQL Schema with validation. Automatically updated.
MIT License
174 stars 62 forks source link

[BUG]: '"@octokit/graphql-schema"' not exporting schema types, TS compilation fails #968

Open EPMatt opened 2 weeks ago

EPMatt commented 2 weeks ago

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

github-actions[bot] commented 2 weeks ago

👋 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! 🚀

wolfy1339 commented 2 weeks ago

What does your tsconfig look like?