Refactor type declarations
TrevorBurgoyne opened this issue · comments
**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)