Skip to content

Commit

Permalink
fix plural form
Browse files Browse the repository at this point in the history
  • Loading branch information
itwillwork committed Nov 13, 2024
1 parent 37c6876 commit af05ca2
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,14 @@ type RequiredPluralValue = {
count: number | string; // "string" parsed via Number constructor
}

export type StrictTypedParams<K extends (StringKey | PluralValue), V = string | number> = (
K extends string
export type StrictTypedParams<K = (StringKey | PluralValue), V = string | number> = (
K extends StringKey
? Record<KeyParam<K>, V>
: Record<KeyParam<K["zero"]> | KeyParam<K['one']> | KeyParam<K['two']> | KeyParam<K['few']> | KeyParam<K['many']> | KeyParam<K['other']>, V> & RequiredPluralValue
: (
K extends PluralValue
? Record<KeyParam<NonNullable<K["zero"]>> | KeyParam<NonNullable<K['one']>> | KeyParam<NonNullable<K['two']>> | KeyParam<NonNullable<K['few']>> | KeyParam<NonNullable<K['many']>> | KeyParam<NonNullable<K['other']>>, V> & RequiredPluralValue
: unknown
)
);

export type StrictTypedParamsI18NFn<T = any> = {
Expand Down

0 comments on commit af05ca2

Please sign in to comment.