Skip to content

Commit

Permalink
fix: Support t.has when getTranslations is called with an object …
Browse files Browse the repository at this point in the history
…argument (#1616)

See
#437 (comment)
  • Loading branch information
amannn authored Dec 18, 2024
1 parent c3375a1 commit 64895a2
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions packages/next-intl/src/server/react-server/getTranslations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,24 @@ Promise<{
>(
key: TargetKey
): any;

// `has`
has<
TargetKey extends MessageKeys<
NestedValueOf<
{'!': IntlMessages},
[NestedKey] extends [never] ? '!' : `!.${NestedKey}`
>,
NestedKeyOf<
NestedValueOf<
{'!': IntlMessages},
[NestedKey] extends [never] ? '!' : `!.${NestedKey}`
>
>
>
>(
key: [TargetKey] extends [never] ? string : TargetKey
): boolean;
}>;
// IMPLEMENTATION
async function getTranslations<
Expand Down

0 comments on commit 64895a2

Please sign in to comment.