-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
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] Move ApiPage
to TS
#43149
Conversation
Netlify deploy previewhttps://deploy-preview-43149--material-ui.netlify.app/ Bundle size report |
8931385
to
6e30808
Compare
Perhaps it could make sense to have two complementary functions? One that throws and one that returns const t = useTranslate()
const maybeString: string | null = t('abc')
const certainlyString: string = t.require('xyz') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks all good to me, everything strongly typed. Left one suggestion about solving the types of the translation function
Extracted from #43128
This PR can be read commit by commit
I tried to move
useTranslate
from(key, options) => any
to(key, options) => string
. But some part of the codebase rely on it returningnull
is the key translation is not defined (the API pages titles) and(key, options) => string | null
leads to a lot of place wheret('...')
needs to be marked as non-nullt('...')!
. SO I dropped this idea