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

feat(NODE-3132): Add TypedEventEmitter #2785

Merged
merged 9 commits into from
May 11, 2021
Merged

feat(NODE-3132): Add TypedEventEmitter #2785

merged 9 commits into from
May 11, 2021

Conversation

nbbeeken
Copy link
Contributor

@nbbeeken nbbeeken commented Apr 20, 2021

Using a mapped type of event names to function type can now provide
annotations and completion for event argument types.

Breaking Changes:

  • Topology open event emits one argument which is the topology itself
  • srvPollingHandler on topology now emits TopologyDescriptionChange event (erroneously was serverDescriptionChanged)

@nbbeeken nbbeeken force-pushed the NODE-3132/typed-events branch 3 times, most recently from 76b5075 to e636d1e Compare April 22, 2021 17:21
@nbbeeken nbbeeken marked this pull request as ready for review April 22, 2021 17:22
@nbbeeken nbbeeken requested review from a team, emadum and dariakp and removed request for a team April 22, 2021 17:22
Copy link
Contributor

@dariakp dariakp left a comment

Choose a reason for hiding this comment

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

Let's make sure there are tests covering at least the breaking changes

Copy link
Contributor

@emadum emadum left a comment

Choose a reason for hiding this comment

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

LGTM! 👍 for the refactor removing relayEvents

@nbbeeken nbbeeken requested a review from dariakp May 6, 2021 17:07
Using a mapped type of event names to function type can now provide
annotations and completion for event argument types.

Breaking Changes:
- Topology open event emits one argument which is the topology itself
- srvPollingHandler on topology now emits TopologyDescriptionChange event (erroneously was serverDescriptionChanged)
Copy link
Contributor

@dariakp dariakp left a comment

Choose a reason for hiding this comment

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

Let's also add an actual ticket for fixing how the srv polling event handler is attached and reference it in the TODO

test/unit/sdam/srv_polling.test.js Outdated Show resolved Hide resolved
@nbbeeken nbbeeken requested a review from dariakp May 7, 2021 18:49
Copy link
Contributor

@dariakp dariakp left a comment

Choose a reason for hiding this comment

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

Looking good

@nbbeeken
Copy link
Contributor Author

Not sure why but EVG failed to run here.
Patch: https://spruce.mongodb.com/version/609980ea1e2d174273aa16ec/tasks

@dariakp
Copy link
Contributor

dariakp commented May 11, 2021

Per discussion, let's create 2 tickets to fix the bugs uncovered by typescript and keep the changes in this PR non-breaking

@dariakp dariakp self-requested a review May 11, 2021 19:42
@nbbeeken nbbeeken changed the title feat(NODE-3132)!: Add TypedEventEmitter feat(NODE-3132): Add TypedEventEmitter May 11, 2021
@nbbeeken
Copy link
Contributor Author

@dariakp Looks like the revert passes if you wanted to take another look here

Copy link
Contributor

@dariakp dariakp left a comment

Choose a reason for hiding this comment

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

LGTM

@nbbeeken nbbeeken merged commit f4d40a4 into 4.0 May 11, 2021
@nbbeeken nbbeeken deleted the NODE-3132/typed-events branch May 11, 2021 22:00
ljhaywar pushed a commit that referenced this pull request Nov 9, 2021
Using a mapped type of event names to function type can now provide
annotations and completion for event argument types.
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

Successfully merging this pull request may close these issues.

3 participants