-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.ts
64 lines (50 loc) · 1.21 KB
/
types.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
52
53
54
55
56
57
58
59
60
61
62
63
64
/// Domain
export type LinkTypes = "email"|"phex"|"location"|"linkedin"|"github"|"skype"|"html"|"pdf"|"npm"
export type tCV<V> = {
title: V
description: V
links: Record<string, P<LinkTypes, Leaf<V>>>
items: Record<"objectives"|"competences"|"languages", CVArticle<V>>
properties: Record<"experience"|"projects"|"education", {
title: V
items: Record<string, CVArticle<V>>
}>
definitions: Record<"subjects"|"stack", Record<string, Term>>
}
export type CVArticle<V> = {
title: V
} & Partial<{
description: V
min: number
max: number
href: string
locations: Array<{
title: V
city: V
} & Partial<{
description: V
}>>
subjects: V[]
stack: V[]
items: Array<Leaf<V>>
}>
export type Leaf<V> = V | {
title: V
href: V
}
export type Term = Partial<{
favor: number
group: string
}>
/// Lang
export type Langed = string | {[L in Langs]?: string}
export type LangRec<T> = T extends any[] ? LangRec<T[number]>[]
: T extends {[k in Langs]?: string}
? string
: T extends AnyObject ? {[k in keyof T]: LangRec<T[k]>}
: T
export type Langs = "en"|"uk"|"he"|"ru"
/// ts-swiss
type AnyObject = Record<string, any>
/** Partial Record */
type P<K extends string, V> = {[k in K]?: V}