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

refactor: Added TypeScript Type Definitions #24

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

Conversation

Aarebecca
Copy link

I noticed that the project was missing the ts type definition, so I inferred the type based on the implementation. If you have any questions, please point them out.

@Aarebecca Aarebecca mentioned this pull request Apr 8, 2024
@vasturiano
Copy link
Owner

@Aarebecca that's good, thanks for your effort here, and for opening the PR.

I do think it would be better to base the type definitions on the existing d3-force package more widely used types, from DefinitelyTyped: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/d3-force/v2/index.d.ts

This module is an extension of d3-force, so for consistency it would be better to base it on those types, and extend it with the relevant sections, namely adding the 3rd (z) dimension, plus the numDimensions method.

@Aarebecca
Copy link
Author

Aarebecca commented Apr 9, 2024

@vasturiano thank you very much for your advice. It was really an oversight on my part.
I've redefined the types based on d3-force, which reduces some of the duplication and ensures consistency.

The screenshot below is a type check performed by ts-server (in strict mode), and everything is fine:
image

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