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

ApolloServerPluginUsageReporting reportTimer has incorrect type #7798

Closed
stijnbe opened this issue Dec 10, 2023 · 1 comment · Fixed by #7799
Closed

ApolloServerPluginUsageReporting reportTimer has incorrect type #7798

stijnbe opened this issue Dec 10, 2023 · 1 comment · Fixed by #7799

Comments

@stijnbe
Copy link
Contributor

stijnbe commented Dec 10, 2023

Issue Description

In src/plugin/usageReporting/plugin.ts

reportTimer is typed as NodeJS.Timer, it is actually a timeout, so using node 18> types it is incompatible
with clearInterval()

node_modules/@apollo/server/src/plugin/usageReporting/plugin.ts:808:27 - error TS2769: No overload matches this call.
  Overload 1 of 2, '(intervalId: string | number | Timeout | undefined): void', gave the following error.
    Argument of type 'Timer' is not assignable to parameter of type 'string | number | Timeout | undefined'.
      Property '[Symbol.dispose]' is missing in type 'Timer' but required in type 'Timeout'.
  Overload 2 of 2, '(id: number | undefined): void', gave the following error.
    Argument of type 'Timer' is not assignable to parameter of type 'number'.

808             clearInterval(reportTimer);
                              ~~~~~~~~~~~

  node_modules/@types/node/timers.d.ts:76:17
    76                 [Symbol.dispose](): void;
                       ~~~~~~~~~~~~~~~~~~~~~~~~~
    '[Symbol.dispose]' is declared here.


Found 1 error in node_modules/@apollo/server/src/plugin/usageReporting/plugin.ts:808

Link to Reproduction

n/a

Reproduction Steps

Update @types/node to > 18

trevor-scheer pushed a commit that referenced this issue Dec 11, 2023
Fixes #7798 
In src/plugin/usageReporting/plugin.ts reportTimer is typed as
NodeJS.Timer, it is actually a timeout, so using node 18> types it is
incompatible with clearInterval()
Copy link
Contributor

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
For general questions, we recommend using StackOverflow or our discord server.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant