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

fix: drop ts type inference for event source #706

Merged

Conversation

Tymek
Copy link
Member

@Tymek Tymek commented Feb 3, 2025

About the changes

  • fix error with dependency typings
  • add test to catch install issues in the future
  • update Node types, to build without errors

Closes #705
Internal ticket: issue/1-3339/node-sdk-missing-dependency-for-types

@Tymek Tymek linked an issue Feb 3, 2025 that may be closed by this pull request
@coveralls
Copy link

coveralls commented Feb 3, 2025

Coverage Status

coverage: 90.575% (+0.01%) from 90.564%
when pulling 500bfba on 705-missing-dependency-for-typeslaunchdarkly-eventsource
into 3b0280e on main.

@Tymek Tymek force-pushed the 705-missing-dependency-for-typeslaunchdarkly-eventsource branch from e383081 to f6dde47 Compare February 4, 2025 12:53
@Tymek Tymek force-pushed the 705-missing-dependency-for-typeslaunchdarkly-eventsource branch from f6dde47 to cdc379e Compare February 4, 2025 13:21
@Tymek Tymek marked this pull request as ready for review February 4, 2025 13:26
@@ -97,7 +97,7 @@ export default class Metrics extends EventEmitter {

private url: string;

private timer: NodeJS.Timer | undefined;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how did you find that this needs to change?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to update Node.js types to fix other error

../node_modules/@types/node/module.d.ts:121:13 - error TS2386: Overload signatures must all be optional or required.

121             resolve?(specified: string, parent?: string | URL): Promise<string>;
                ~~~~~~~

And new types where complaining about NodeJS.Timer

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, we should add Node v22 to our test array.
https://nodejs.org/en/about/previous-releases

echo -e "import { Unleash } from 'unleash-client';\nvoid Unleash;\nconsole.log('Hello world');" > src/index.ts
./node_modules/.bin/tsc -b tsconfig.json

if [ "$(node . 2>&1)" = "Hello world" ]; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need those checks? Isn't checking exit code from tsc to be 0 enough?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This way we can extend tests, and check if Unleash is reporting errors.

@@ -5105,6 +5107,11 @@ undici-types@~5.26.4:
resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617"
integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==

undici-types@~6.19.2:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it from the upgraded @types/node transitive deps?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

Copy link
Contributor

@kwasniew kwasniew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO, everything in a test-package required a README explaining why it exists, what problem is solves and what we're checking (since we can't add inline comments in JSON files).

@Tymek Tymek merged commit 127ea76 into main Feb 4, 2025
5 checks passed
@Tymek Tymek deleted the 705-missing-dependency-for-typeslaunchdarkly-eventsource branch February 4, 2025 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Missing dependency for @types/launchdarkly-eventsource
3 participants