-
-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathindex.d.ts
37 lines (36 loc) · 906 Bytes
/
index.d.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
type Mapped<T> = T extends readonly []
? []
: T extends ""
? ""
: T extends `boolean(${string}`
? boolean
: T extends `count(${string}`
? number
: T extends `ceiling(${string}`
? number
: T extends `floor(${string}`
? number
: T extends `number(${string}`
? number
: T extends `sum(${string}`
? number
: T extends string
? string
: T extends readonly [string, infer X]
? X extends Readonly<Record<string, any>>
? Transformed<X>[]
: Mapped<X>[]
: never;
export type Transformed<T extends Record<string, any>> = {
[K in keyof T]: Mapped<T[K]>;
};
export function prettyPrint(
xml: string,
opts?: { indentSize: number }
): Promise<string>;
export function toJson(xml: string): Promise<any>;
export function transform<const T extends Record<string, any>>(
xml: string,
template: T
): Promise<Transformed<T>>;
export function destroy(): Promise<void>;