lingui / lingui/js-lingui

format props missing in <Plural> compared to the docs

Open
#2,072 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
5.9k
Forks
457
Avg merge
1d 23h
Merged PRs (30d)
16

Description

**Describe the bug**
I want to use Plural JSX element imported from: `import { Plural } from "@lingui/macro";`
In the documentation from the website [https://lingui.dev/ref/macro#plural-1](https://lingui.dev/ref/macro#plural-1), it is reported that `format` is available. However, `PluralChoiceProps` doesn't contain it:
```ts
type PluralChoiceProps = {
value: string | number
/** Offset of value when calculating plural forms */
offset?: number
zero?: ReactNode
one?: ReactNode
two?: ReactNode
few?: ReactNode
many?: ReactNode

/** Catch-all option */
other: ReactNode
/** Exact match form, corresponds to =N rule */
[digit: `_${number}`]: ReactNode
} & CommonProps
```

**Expected behavior**
`format` to be available in the `` props

- jsLingui version `4.13.0`
- SWC version ("@lingui/swc-plugin) `4.0.9`
- Macro support:
- [x ] I'm using SWC with `@lingui/swc-plugin`
- [ ] I'm using Babel with `babel-macro-plugin`
- [ ] I'm not using macro
- Framework used: NextJs

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the TypeScript definition of PluralChoiceProps and compare it with the Plural macro documentation at the linked page. Check the existing Plural-related tests or type checks, then confirm that the documented format prop is represented consistently and covered by validation before considering the issue done.

Written by the indexing model from the issue text.

Assessment

Tech stack
nextjs, react, typescript
Domain
frontend, internationalization
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.