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 type declarations #131

Open
TrevorBurgoyne opened this issue Feb 16, 2024 · 0 comments
Open

Refactor type declarations #131

TrevorBurgoyne opened this issue Feb 16, 2024 · 0 comments
Labels
refactor The code should be better

Comments

@TrevorBurgoyne
Copy link
Member

       **General Comments**

We have a lot of overlap of types throughout this project and I think that it's getting pretty messy and confusing. I also recently learned that the way we handle custom types in this project is not considered very good practice. In general types should be declared in 3 different places. First is inside of index.d.ts. This file should be used for types that are useful for interfacing with the project when ulabel is being imported. And index.d.ts can also be imported from internally for each file that needs a given type. The second place is inside of a dedicated types.ts (or some other generic\preferred name) for types that are useful across multiple files in the project. They can then be imported as needed from that file. Finally types can should be declared at the top of a typescript file if they are useful inside of that file, but not needed in any other file in the project. This system can keep our type system more organized and reduce duplicated types.
For example we currently have two types that behave exactly the same.
type ULabelSpatialPayload = [number, number][] and
type Point2D = [number, number]
type ULabelSpatialPayload2D = Point2D[]

Originally posted by @csolbs24 in #129 (review)

@TrevorBurgoyne TrevorBurgoyne added the refactor The code should be better label Feb 16, 2024
@joshua-dean joshua-dean mentioned this issue Oct 3, 2024
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor The code should be better
Projects
None yet
Development

No branches or pull requests

1 participant