Skip to content

Regression with "Part options support for $n" #2192

Closed
@pinguet62

Description

@pinguet62

Reporting a bug?

#2170
#2174
The 2 PR change typing of n() from simple string to string | Intl.NumberFormatPart[].
Now it's necessary to complexify all usages of n(): we have to check type and cast or convert data...

Probably same issue with d date formatter!

Expected behavior

The typing should be dynamic, depending the { part: true } option value:

n(42) // string
n(42, {}) // string
n(42, { part: false }) // string
n(42, { part: true }) // Intl.NumberFormatPart[]

Reproduction

<AComponent :aPropsOfTypeString="n(42)" />
const { n } = useI18n()
const value: string = n(42)

System Info

v11.1.4

Screenshot

No response

Additional context

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions