-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.generated.ts
51 lines (43 loc) · 2.04 KB
/
example.generated.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// THIS FILE IS AUTOMATICALLY GENERATED BY (i18-types-generator-cli)
// MADE BY https://github.com/Morabotti
export enum Language {
En = 'en',
Fi = 'fi'
}
export enum Namespace {
CombineCaseTestOne = 'combine_case-test-_one',
Group = 'group',
KebabCase = 'kebab-case',
SnakeCase = 'snake_case',
Test = 'test'
}
export type CombineCaseTestOneKeys = 'key';
export type GroupKeys = 'test_dashboard' | 'omage' | 'alpha' | 'beta' | 'nested.nested_value' | 'nested.nested.nested_value';
export type KebabCaseKeys = 'key-kebab';
export type SnakeCaseKeys = 'key_snake';
export type TestKeys = 'first' | 'second' | 'third' | 'nested.fourth' | 'nested.nested.fifth';
export type TranslationKey = CombineCaseTestOneKeys | GroupKeys | KebabCaseKeys | SnakeCaseKeys | TestKeys;
interface Map {
[Namespace.CombineCaseTestOne]: CombineCaseTestOneKeys;
[Namespace.Group]: GroupKeys;
[Namespace.KebabCase]: KebabCaseKeys;
[Namespace.SnakeCase]: SnakeCaseKeys;
[Namespace.Test]: TestKeys;
}
interface NSMap {
[Namespace.CombineCaseTestOne]: `combine_case-test-_one:${CombineCaseTestOneKeys}`;
[Namespace.Group]: `group:${GroupKeys}`;
[Namespace.KebabCase]: `kebab-case:${KebabCaseKeys}`;
[Namespace.SnakeCase]: `snake_case:${SnakeCaseKeys}`;
[Namespace.Test]: `test:${TestKeys}`;
}
type PickMap<X extends Namespace> = Map[X];
type PickMultiple<X extends Namespace[]> = X extends { length: 1 } ? Map[X[0]]
: X extends { length: 2 } ? NSMap[X[0]] | NSMap[X[1]]
: X extends { length: 3 } ? NSMap[X[0]] | NSMap[X[1]] | NSMap[X[2]]
: X extends { length: 4 } ? NSMap[X[0]] | NSMap[X[1]] | NSMap[X[2]] | NSMap[X[3]]
: X extends { length: 5 } ? NSMap[X[0]] | NSMap[X[1]] | NSMap[X[2]] | NSMap[X[3]] | NSMap[X[4]]
: X extends { length: 6 } ? NSMap[X[0]] | NSMap[X[1]] | NSMap[X[2]] | NSMap[X[3]] | NSMap[X[4]] | NSMap[X[5]]
: NSMap[X[0]] | NSMap[X[1]] | NSMap[X[2]] | NSMap[X[3]] | NSMap[X[4]] | NSMap[X[5]] | NSMap[X[6]];
export type TranslationMapping<X extends Namespace> = PickMap<X>;
export type TranslationsMapping<X extends Namespace[]> = PickMultiple<X>;