Skip to content

Commit 64895a2

Browse files
authored
fix: Support t.has when getTranslations is called with an object argument (#1616)
See #437 (comment)
1 parent c3375a1 commit 64895a2

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

packages/next-intl/src/server/react-server/getTranslations.tsx

+18
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,24 @@ Promise<{
210210
>(
211211
key: TargetKey
212212
): any;
213+
214+
// `has`
215+
has<
216+
TargetKey extends MessageKeys<
217+
NestedValueOf<
218+
{'!': IntlMessages},
219+
[NestedKey] extends [never] ? '!' : `!.${NestedKey}`
220+
>,
221+
NestedKeyOf<
222+
NestedValueOf<
223+
{'!': IntlMessages},
224+
[NestedKey] extends [never] ? '!' : `!.${NestedKey}`
225+
>
226+
>
227+
>
228+
>(
229+
key: [TargetKey] extends [never] ? string : TargetKey
230+
): boolean;
213231
}>;
214232
// IMPLEMENTATION
215233
async function getTranslations<

0 commit comments

Comments
 (0)