-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.d.ts
74 lines (57 loc) · 1.87 KB
/
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
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
65
66
67
68
69
70
71
72
73
74
import fs from 'fs-extra'
import fg from 'fast-glob'
import { cd } from 'zx'
export interface IOReturn<T> {
data: T
save(v?: T): Promise<void>
read(): T
}
export interface IOSyncReturn<T> {
data: T
save(v?: T): void
read(): T
}
interface Read {
(str: string): Promise<string>
(template: TemplateStringsArray, ...substitutions: any[]): Promise<string>
sync(str: string): string
sync(template: TemplateStringsArray, ...substitutions: any[]): string
json: {
<T>(str: string): Promise<T>
<T>(template: TemplateStringsArray, ...substitutions: any[]): Promise<T>
sync<T>(str: string): T
sync<T>(template: TemplateStringsArray, ...substitutions: any[]): T
}
}
interface Remove {
(str: string): Promise<void>
(template: TemplateStringsArray, ...substitutions: any[]): Promise<void>
}
interface Exists {
(str: string): boolean
(template: TemplateStringsArray, ...substitutions: any[]): boolean
}
interface Write {
(path: string, content: string): Promise<void>
sync(path: string, content: string): void
}
interface IO {
(str: string): Promise<IOReturn<string>>
(template: TemplateStringsArray, ...substitutions: any[]): Promise<IOReturn<string>>
sync(str: string): IOSyncReturn<string>
sync(template: TemplateStringsArray, ...substitutions: any[]): IOSyncReturn<string>
json: {
<T>(str: string): Promise<IOReturn<T>>
<T>(template: TemplateStringsArray, ...substitutions: any[]): Promise<IOReturn<T>>
sync<T>(str: string): IOSyncReturn<T>
sync<T>(template: TemplateStringsArray, ...substitutions: any[]): IOSyncReturn<T>
spaces: number
}
}
export declare const read: Read
export declare const write: Write
export declare const remove: Remove
export declare const exists: Exists
export declare const io: IO
export function glob(template: TemplateStringsArray, ...substitutions: any[]): Promise<string[]>
export { cd, fs, fg }