-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstatic.ts
More file actions
30 lines (26 loc) · 701 Bytes
/
Copy pathstatic.ts
File metadata and controls
30 lines (26 loc) · 701 Bytes
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
export class TranslatedNumber {
public static supported: string[] = ['en', 'mi']
constructor(
private value: number,
private en: string,
private mi: string
) {}
getAll(): { value: number; en: string; mi: string } {
return {
value: this.value,
en: this.en,
mi: this.mi,
}
}
static fromTuple<T extends typeof TranslatedNumber>(
this: T,
values: [value: number, en: string, mi: string]
): InstanceType<T> {
return new this(...values) as InstanceType<T>
}
}
export class ShoutyTranslatedNumber extends TranslatedNumber {
constructor(value: number, en: string, mi: string) {
super(value, en.toUpperCase(), mi.toUpperCase())
}
}