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

[docs-infra] Improve type naming on the API pages #41073

Open
danilo-leal opened this issue Feb 12, 2024 · 6 comments
Open

[docs-infra] Improve type naming on the API pages #41073

danilo-leal opened this issue Feb 12, 2024 · 6 comments
Labels
enhancement This is not a bug, nor a new feature scope: docs-infra Specific to the docs-infra product

Comments

@danilo-leal
Copy link
Contributor

danilo-leal commented Feb 12, 2024

We're using a shorthand notation to mention to type names that seem to be about React's prop-types, like bool.

Screenshot 2023-08-21 at 23 37 53

https://mui.com/material-ui/api/fade/#fade-prop-appear

But it seems to make more sense to use the full name for it to be more accurate with how TypeScript refers to them — e.g., boolean.

This naming design optimizes for a time when most developers would write "propType". Today, these developers are a lot more likely to write TypeScript types, so it will bring a more intuitive DX to make the change:

  • bool → boolean
  • func → function
  • etc.

Search keywords: type naming, api page

@danilo-leal danilo-leal added status: waiting for maintainer These issues haven't been looked at yet by a maintainer scope: docs-infra Specific to the docs-infra product and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Feb 12, 2024
@oliviertassinari oliviertassinari added the enhancement This is not a bug, nor a new feature label Feb 12, 2024
@EyaOuenniche
Copy link
Contributor

Hello,
I agree, it think it makes more sense to use the full name in order to be more accurate with how TypeScript refers to them.
If this improvement is going to be implemented, I would like to help.

@danilo-leal
Copy link
Contributor Author

@EyaOuenniche sure, yeah! Feel free to kickstart it and ask for a review :)
Let me know if you need any help, and I can give you pointers!

@EyaOuenniche
Copy link
Contributor

Great! Thank you.
I changed the type names on the API pages for the fade component and I just created a pull request.

@danilo-leal
Copy link
Contributor Author

@EyaOuenniche hey there! The Fade page linked in the issue is just one illustrative example — the correct approach would be to change in a place where the entire documentation platform is affected (not just the Fade API page).

I've looked into it myself and couldn't precisely figure out where to go to change that, so I'll summon @mui/docs-infra for further help :)

@EyaOuenniche
Copy link
Contributor

hello!
I understand, I will also try to search for the place where the entire documentation platform is affected.

@alexfauquette
Copy link
Member

I can see two places. The first one generate the type of the props.
The second recursively resolves composed types.

if ('name' in type) {
return type.name;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This is not a bug, nor a new feature scope: docs-infra Specific to the docs-infra product
Projects
Status: Selected
Development

No branches or pull requests

4 participants