Skip to content

Commit 9d65805

Browse files
authored
fix(next-international): resolve consistent scoped types (#329)
1 parent 79f797c commit 9d65805

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

packages/next-international/src/app/server/create-get-scoped-i18n.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ export function createGetScopedI18n<Locales extends ImportedLocales, Locale exte
1010
) {
1111
const localeCache = new Map<string, ReturnType<typeof createT<Locale, undefined>>>();
1212

13-
return async function getScopedI18n<Scope extends Scopes<Locale>>(scope: Scope) {
13+
return async function getScopedI18n<Scope extends Scopes<Locale>>(
14+
scope: Scope,
15+
): Promise<ReturnType<typeof createT<Locale, Scope>>> {
1416
const locale = getLocaleCache();
1517
const cacheKey = `${locale}-${scope}`;
1618
const cached = localeCache.get(cacheKey);

packages/next-international/src/common/create-use-scoped-i18n.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export function createScopedUsei18n<Locale extends BaseLocale>(
99
) {
1010
const localeCache = new Map<string, ReturnType<typeof createT<Locale, undefined>>>();
1111

12-
return function useScopedI18n<Scope extends Scopes<Locale> | undefined>(scope: Scope) {
12+
return function useScopedI18n<Scope extends Scopes<Locale>>(scope: Scope): ReturnType<typeof createT<Locale, Scope>> {
1313
const context = useContext(I18nClientContext);
1414

1515
if (!context) {

0 commit comments

Comments
 (0)