[RFC] What types should we make private/public? #1780
Replies: 6 comments 10 replies
-
@m4theushw I have resolved the comment as it's not really important. The biggest value I saw was an exported type that could have been inlined, a type that is currently not easy to discover as a developer (maybe a better doc can solve this?).
In mui/material-ui#26187, for me, the conclusion was that: it's better without these types but it's a breaking change, we have already done too many for v5. Regarding Sebastian's point, yeah, it's definitely a downside, but what's the alternative? Expose a type for all the props of the components? Does it scale? I fail to envision it.
I don't understand this part. Shouldn't all the public APIs be documented and vis-verca? @m4theushw What's the advantage of using a GitHub discussion over GitHub issues? My assumption is that the |
Beta Was this translation helpful? Give feedback.
-
@oliviertassinari If we start making types inline first, and only creating aliases for when there's two or more usages of them, then it will scale well. The inverse is not true, as once a type is exported and we don't want it anymore that will require a major release to remove it.
It can access but it will not generate documentation for the type if it's not exported. It works in a lazy way, doesn't explore the type to discover more types.
We decided to use it during the retrospective, to avoid having off-topic discussions in PRs. We could open RFCs issues as well. I can't close this discussion because it's open ended. To close it, its category should be one that follows the question / answer format. |
Beta Was this translation helpful? Give feedback.
-
I like that. I have changed the type of the category to "Question / Answer" as we are looking for a decision on how to design the public API 😁 |
Beta Was this translation helpful? Give feedback.
-
Ok, as far as I can see we at least can agree on one point for now - we need to have documentation via TypeDoc, so not exposing anything is not an option, but we can have inline types if they are used in only one place. So basically if we are going to use the type in a single place then inline it, if it's used in more than one place then abstract it. If we can agree to that it would be a great start. |
Beta Was this translation helpful? Give feedback.
-
IMO it helps users to have all types available as
Another option would be to mark some types or props as unstable or experimental in typeDoc so ppl are aware that it can change soon. |
Beta Was this translation helpful? Give feedback.
-
Quick one to add to the debate: |
Beta Was this translation helpful? Give feedback.
-
At this moment, we're exporting all the types we use internally, but should we continue with this approach or make some of them private? This discussion started in #1778 (comment).
In the core, the same problem was raised, but we agreed to keep the accessory types public. The rationale was that getting them via props (e.g.
GridColDef['cellClassName']
) created more complexity than using an export: mui/material-ui#26187 (comment)The main reason for me to keep them public is documentation. TypeDoc only sees what is exported. If we make some types private, we won't be able to describe the real values accepted by a prop, like below:
Beta Was this translation helpful? Give feedback.
All reactions