How do we want to organize types in @dhis2/multi-calendar-dates? #338
Unanswered
Mohammer5
asked this question in
Specs & RFCs
Replies: 1 comment 3 replies
-
Differentiate between "exported types", "global types" & "local types"To me, there are clear advantages when specifying exported types separately from the rest of the project. Having an
Using local types that are internal to a module (file):
Using global, but internal types, we can easily declare types that can be used through-out the entire project. But instead of scattering them through our application, we have one dedicated place for these types:
Several large and well-known projects follow this or a very similar pattern:
SummaryBy following this pattern,
|
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
There are various ways of declaring types in TS projects, all come with their own set of advantages and disadvantages.
I'd like to talk about which options we have, so we can decide which way we'd like to go forward.
There are some considerations:
/build/types/index.d.ts
(and colocated type files, which is what our platform script does) or do we want to explicitly define anindex.d.ts
(for example in<root>/index.d.ts
)?This topic does not only affect how we bundle types with our libraries, it also has an impact on our type design. Type design is a very important topic, as the design - when done wrong - can increase the complexity of the library significantly, and we'll have a hard time maintaining the library. Contributing to the library is especially more difficult for people outside dhis2 when we unintentionally yet unnecessarily increase the complexity.
Here are some resources that can serve as inspiration for investigating this topic:
Beta Was this translation helpful? Give feedback.
All reactions