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

TSC compilation failed #55

Open
NIR-G-hci opened this issue Jan 23, 2025 · 1 comment
Open

TSC compilation failed #55

NIR-G-hci opened this issue Jan 23, 2025 · 1 comment

Comments

@NIR-G-hci
Copy link

NIR-G-hci commented Jan 23, 2025

Hi, I'm using node 16.19, and I tried to install statsig-node version 6.3.0 and also 5.31, the case happened in both of them.
It looks like the package uses clearTimeout(timer); with bad syntax or something not supported
can you please fix it or let me know what I should do to fix it from my side?
I'm trying to compile my code with tsc -p .

This is the error:
` tsc -p .
node_modules/statsig-node/src/LogEventProcessor.ts:149:21 - error TS2769: No overload matches this call.
Overload 1 of 2, '(intervalId: string | number | Timeout): void', gave the following error.
Argument of type 'Timer' is not assignable to parameter of type 'string | number | Timeout'.
Property '[Symbol.dispose]' is missing in type 'Timer' but required in type 'Timeout'.
Overload 2 of 2, '(id: number): void', gave the following error.
Argument of type 'Timer' is not assignable to parameter of type 'number'.

149 clearInterval(this.flushTimer);
~~~~~~~~~~~~~~~

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

node_modules/statsig-node/src/LogEventProcessor.ts:153:21 - error TS2769: No overload matches this call.
Overload 1 of 2, '(intervalId: string | number | Timeout): void', gave the following error.
Argument of type 'Timer' is not assignable to parameter of type 'string | number | Timeout'.
Property '[Symbol.dispose]' is missing in type 'Timer' but required in type 'Timeout'.
Overload 2 of 2, '(id: number): void', gave the following error.
Argument of type 'Timer' is not assignable to parameter of type 'number'.

153 clearInterval(this.deduperTimer);
~~~~~~~~~~~~~~~~~

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

node_modules/statsig-node/src/utils/Dispatcher.ts:92:20 - error TS2769: No overload matches this call.
Overload 1 of 2, '(timeoutId: string | number | Timeout): void', gave the following error.
Argument of type 'Timer' is not assignable to parameter of type 'string | number | Timeout'.
Property '[Symbol.dispose]' is missing in type 'Timer' but required in type 'Timeout'.
Overload 2 of 2, '(id: number): void', gave the following error.
Argument of type 'Timer' is not assignable to parameter of type 'number'.

92 clearTimeout(this.drainTimer);
~~~~~~~~~~~~~~~

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

node_modules/statsig-node/src/utils/StatsigFetcher.ts:237:24 - error TS2769: No overload matches this call.
Overload 1 of 2, '(timeoutId: string | number | Timeout): void', gave the following error.
Argument of type 'Timer' is not assignable to parameter of type 'string | number | Timeout'.
Property '[Symbol.dispose]' is missing in type 'Timer' but required in type 'Timeout'.
Overload 2 of 2, '(id: number): void', gave the following error.
Argument of type 'Timer' is not assignable to parameter of type 'number'.

237 clearTimeout(timer);
~~~~~

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

Found 4 errors in 3 files.

Errors Files
2 node_modules/statsig-node/src/LogEventProcessor.ts:149
1 node_modules/statsig-node/src/utils/Dispatcher.ts:92
1 node_modules/statsig-node/src/utils/StatsigFetcher.ts:237`

maybe this link can help :
https://stackoverflow.com/questions/55550096/ts2322-type-timeout-is-not-assignable-to-type-number-when-running-unit-te
Thanks!

@andre-statsig
Copy link
Contributor

Hey, thanks for reporting this issue!

If you installed statsig-node in your repo, tsc shouldn't be trying to compile the *.ts files under node_modules/statsig-node/src/..., because we already build them into *.js and *.d.ts files.

How are you importing statsig-node into your project? Are there any imports for "statsig-node/src/..." in your codebase?

If that's not the case, here are other resources that would help this investigation:

  1. Your tsconfig.json file
  2. The typescript version in your package.json file

Even better would be a repository in stackblit, codesandbox, replit or similar which reproduces these build errors.

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

2 participants