-
-
Notifications
You must be signed in to change notification settings - Fork 929
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add autocomplete support for locales #248
Conversation
✔️ Deploy Preview for vigilant-wescoff-04e480 ready! 🔨 Explore the source changes: 77e08ba 🔍 Inspect the deploy log: https://app.netlify.com/sites/vigilant-wescoff-04e480/deploys/61eb2cb9c1bb40000987678b 😎 Browse the preview: https://deploy-preview-248--vigilant-wescoff-04e480.netlify.app |
This doesn't work yet due to |
This PR depends on #249 |
@@ -56,7 +56,67 @@ import zh_CN from './zh_CN'; | |||
import zh_TW from './zh_TW'; | |||
import zu_ZA from './zu_ZA'; | |||
|
|||
const locales: { [lang: string]: LocaleDefinition } = { | |||
export type KnownLocale = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couldn't you use keyof typeof locales
, so we don't have to repeat the same thing again?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wont this result in a circular type?
One of them needs to be defined first, or not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, first create the locales, and then below it, create the KnownLocale
type. There is no circular reference if they stay in the same file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please create an issue (or PR) for that?
I currently work on something different and don't want to forget about it.
I will automate the generation/update for
KnownLocale
s in a later PR.The is the TypeScript related part for #210