-
Notifications
You must be signed in to change notification settings - Fork 397
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
Mess in exported Macro Typescript Typings #1323
Comments
Related: #1288
|
No, you're right. // Macro
<Trans>Hello <strong>{name}</strong></Trans>
// Component
<Trans
id="Hello <0>{name}</0>"
values={{ name }}
components={[<strong />]}
/> Howerver, // Macro
<Trans>Hello world</Trans>
// Component
<Trans id="Hello world" /> In the end, separating macro props from component props seems to be a good idea. |
Children is valid only for macro, not for Plural / SelectOrdinal / Select |
Typings fixed in #1340 which will be a part of v4. |
I'm continuing digging into the sourcecode and test suite. Here what i've found:
According to the exported typings all JSX Macro components (Trans, Plural, etc) have common
Trans
props, which is following:This is actually wrong, because JSX Macro (from the source code and tests) could accept only this set properties:
So passing any of the properties highlihted in the snippet above will not work. These typings just bring mess and confusing for end users. (it's actually props of original
Trans
runtime component, not a macro).Proofs: https://github.com/lingui/js-lingui/blob/main/packages/macro/src/macroJsx.ts#L179-L194
Other properties would stripped or inlined as choice options in ICU Choice component.
Am i missing something or it's here by historical reasons and a just need to be cleaned up wisely?
The text was updated successfully, but these errors were encountered: