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

Adds JSDoc support for EventManager #327

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

niklaswallerstedt
Copy link

This PR enables typechecking for JS and the Event Manager class.

Since the project is mostly written in javascript, I thought it would be suitable to start to add gradual types to the codebase. I've only started with the Event Manager class for you to get a feel of what it might look like and the DX around it.

  • Enables types for js, but do not enforce it
  • Refactors types for simpler testing
  • Updates tests and types
  • Adds typechecking to Event Manager
  • Updates package-lock version mismatch
  • Fixes tests that broke after tsconfig change

Copy link

netlify bot commented Nov 15, 2023

Deploy Preview for electrodb-dev canceled.

Name Link
🔨 Latest commit 039e6a6
🔍 Latest deploy log https://app.netlify.com/sites/electrodb-dev/deploys/655904dfee9fe400088b0b34

Copy link
Author

Choose a reason for hiding this comment

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

There was a version mismatch when installing.

/**
* @type {Array<ElectroEventListener>}
* */
#listeners;
Copy link
Author

Choose a reason for hiding this comment

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

Updated the class to use private properties

Comment on lines +28 to +29
// no-op
return () => {};
Copy link
Author

Choose a reason for hiding this comment

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

I could not get the filter to understand that undefined would have been removed even with type guards, so changed it to a no-op and removed the filter entirely.

Adds typechecking to Event Manager

- Updates package-lock version mismatch
- Fixes tests that broke after tsconfig change
- Adds comment for ts error
- Refactors types for simpler testing
- Updates tests and types
@tywalch
Copy link
Owner

tywalch commented Nov 17, 2023

This is week is crazy for me, I hope to review this over the weekend 👍

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.

None yet

2 participants