Consider renaming of the macro components
- Dominant language
- TypeScript
- Stars
- 5.9k
- Forks
- 457
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 16
Description
Extracted from [here](https://github.com/lingui/js-lingui/pull/1859#issuecomment-1972752328)
I believe the initial idea for macro was a "subset" of the original params from runtime versions (as original author [said](https://github.com/lingui/js-lingui/issues/1433#issuecomment-1467778710)). So they signatures originally had to match to each other.
But since then react/js ecosystem shifted towards typescript and quality typings and high type safety become a more valuable than ever. That resulted in changes in lingui, where runtime and macro version got they own typings with different signatures to highlight for developers different usages of macro/runtime versions.
So now we have`Trans` from `/react` and `Trans` from `/react/macro` which are different components. This PR will add `useLingui` from `/react/macro` in additional to `/react`.
This is indeed confusing. It's also confusing for IDEs, they can automatically add import to incorrect symbol and user may spend hours to understand why it doesn't work as expected.
I think, maybe it's time to change the naming to something more explicit?
`Trans` / `TransM` and `useLingui` / `useLinguiM`
The `Plural`, `Select` and `SelectOrdinal` don't have runtime counterparts, they are transpiled to `Trans`, but i believe they should be renamed to follow the same naming convention:
`PluralM` `SelectM` and `SelectOrdinalM`
What do you think? What would be a better name for Macro version? Do you think this is worth the discussion, or it's fine how it is right now?
Contributor guide
Research direction
Start by comparing the exports and typings from /react and /react/macro, especially Trans and useLingui, along with the macro-only Plural, Select, and SelectOrdinal components. Review the linked discussion and existing issue context first; this issue is currently a naming proposal, so “done” would require an agreed naming direction and a defined migration scope.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend, internationalization
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100