Specify type of useLocale #477
Answered
by
amannn
TommySorensen
asked this question in
Q&A
-
Beta Was this translation helpful? Give feedback.
Answered by
amannn
Aug 24, 2023
Replies: 1 comment 3 replies
-
Currently only if you wrap the function: import {useLocale as useUntypedLocale} from 'next-intl';
export default function useLocale() {
return useUntypedLocale() as 'en' | 'en-GB';
} I've been thinking about a way to provide this within the library, as with the App Router, we can guarantee that only known locales are returned. For the Pages Router this was not possible with the way the library is integrated. |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
TommySorensen
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Currently only if you wrap the function:
I've been thinking about a way to provide this within the library, as with the App Router, we can guarantee that only known locales are returned. For the Pages Router this was not possible with the way the library is integrated.