File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed
Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change 1+ /* eslint-disable @typescript-eslint/no-empty-object-type */
12/* eslint-disable @typescript-eslint/consistent-type-definitions */
23/* eslint-disable @typescript-eslint/no-namespace */
34
45import type { OmitIndexSignature , Primitive , Simplify } from 'type-fest' ;
56
67import type libuiTranslations from './translations/libui.json' ;
78
9+ interface TranslationsLike {
10+ [ key : string ] : TranslationsLike | { [ L in Language ] ?: string } ;
11+ }
12+
813export declare namespace UserConfig {
914 interface LanguageOptions {
1015 [ key : string ] : boolean ;
1116 }
12- interface Translations {
13- [ key : string ] :
14- | Translations
15- | {
16- [ L in Language ] ?: string ;
17- } ;
18- }
17+ interface Translations extends TranslationsLike { }
1918}
2019
2120export type LanguageOptions = UserConfig . LanguageOptions & {
@@ -44,7 +43,7 @@ export type TranslationNamespace = Extract<keyof Translations, string>;
4443export type TranslationKey = ExtractTranslationKey < Translations > ;
4544
4645export type TranslationKeyForNamespace < TNamespace extends TranslationNamespace > =
47- TranslationKey extends `${TNamespace } .${infer TKey } ` ? TKey : never ;
46+ Extract < TranslationKey , `${ TNamespace } .${ string } ` > extends `${TNamespace } .${infer TKey } ` ? TKey : never ;
4847
4948export type TranslateFormatArgs =
5049 | Exclude < Primitive , symbol > [ ]
You can’t perform that action at this time.
0 commit comments