Skip to content

Commit

Permalink
fix(next-international): resolve consistent scoped types (#329)
Browse files Browse the repository at this point in the history
  • Loading branch information
ubinatus authored Jan 8, 2024
1 parent 79f797c commit 9d65805
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ export function createGetScopedI18n<Locales extends ImportedLocales, Locale exte
) {
const localeCache = new Map<string, ReturnType<typeof createT<Locale, undefined>>>();

return async function getScopedI18n<Scope extends Scopes<Locale>>(scope: Scope) {
return async function getScopedI18n<Scope extends Scopes<Locale>>(
scope: Scope,
): Promise<ReturnType<typeof createT<Locale, Scope>>> {
const locale = getLocaleCache();
const cacheKey = `${locale}-${scope}`;
const cached = localeCache.get(cacheKey);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export function createScopedUsei18n<Locale extends BaseLocale>(
) {
const localeCache = new Map<string, ReturnType<typeof createT<Locale, undefined>>>();

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

if (!context) {
Expand Down

0 comments on commit 9d65805

Please sign in to comment.