-
Notifications
You must be signed in to change notification settings - Fork 6
/
index.d.ts
268 lines (223 loc) · 12.3 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
export = exports;
declare namespace exports {
export const version :'1.35.0';
export const parse :
& {
(this :void, source :Source, specificationVersion :1.0 | 0.5 | 0.4 | 0.3 | 0.2 | 0.1, multilineStringJoiner? :string, useBigInt? :boolean | number, xOptions? :XOptions ) :Table;
(this :void, source :Source, multilineStringJoiner? :string, useBigInt? :boolean | number, xOptions? :XOptions ) :Table;
(this :void, source :Source, options? :{ readonly joiner? :string, readonly bigint? :boolean | number, readonly x ? :XOptions }) :Table;
}
& {
readonly [SpecificationVersion in 1.0 | 0.5 | 0.4 | 0.3 | 0.2 | 0.1] :{
(this :void, source :Source, multilineStringJoiner? :string, useBigInt? :boolean | number, xOptions? :XOptions ) :Table;
(this :void, source :Source, options? :{ readonly joiner? :string, readonly bigint? :boolean | number, readonly x ? :XOptions }) :Table;
}
};
export function stringify (this :void, rootTable :ReadonlyTable, options? :{
readonly integer? :number
readonly newline? :'\n' | '\r\n'
readonly newlineAround? :'document' | 'section' | 'header' | 'pairs' | 'pair'
readonly indent? :string | number
readonly T? :'T' | 't' | ' '
readonly Z? :'Z' | 'z'
readonly xNull? :boolean
readonly xBeforeNewlineInMultilineTable? :',' | ''
readonly forceInlineArraySpacing? :0 | 1 | 2 | 3
}) :string;
export function isSection (this :void, table :ReadonlyTable) :boolean;
export function isInline (this :void, value :ReadonlyTable | ReadonlyArray) :boolean;
export function Section<T extends ReadonlyTable> (this :void, table :T) :T;
export function inline<T extends ReadonlyArray> (this :void, value :T, inlineMode? :0 | 1 | 2 | 3) :T;
export function inline<T extends ReadonlyTable> (this :void, value :T) :T;
export const multiline :{
readonly array :{
<T extends ReadonlyArray>
(this :void, array :T ) :T
}
<T extends ReadonlyTable>
(this :void, table :T ) :T
(this :void, value :string ) :{ [_literal] :[ `"""`, ...string[], `${string}"""` ] | [ `'''`, ...string[], `${string}'''` ] } & object & String
(this :void, lines :readonly string[] ) :{ [_literal] :[ `"""`, ...string[], `${string}"""` ] | [ `'''`, ...string[], `${string}'''` ] } & object
(this :void, lines :readonly string[], value :string) :{ [_literal] :[ `"""`, ...string[], `${string}"""` ] | [ `'''`, ...string[], `${string}'''` ] } & object & String
readonly basic :{
(this :void, value :string ) :{ [_literal] :[ `"""`, ...string[], `${string}"""` ] } & object & String
(this :void, lines :readonly string[] ) :{ [_literal] :[ `"""`, ...string[], `${string}"""` ] } & object
(this :void, lines :readonly string[], value :string) :{ [_literal] :[ `"""`, ...string[], `${string}"""` ] } & object & String
}
};
export function basic (this :void, value :string ) :{ [_literal] :`"${string}"` } & object & String;
export function literal (this :void, literal :string ) :{ [_literal] :string | [ string, ...string[] ] } & object ;
export function literal (this :void, literal :string, value :string ) :{ [_literal] :string | [ string, ...string[] ] } & object & String;
export function literal (this :void, literal :string, value :number ) :{ [_literal] :string | [ string, ...string[] ] } & object & Number;
export function literal (this :void, literal :string, value :bigint ) :{ [_literal] :string | [ string, ...string[] ] } & object & BigInt;
export function literal (this :void, literal :TemplateStringsArray, ...chars :string[]) :{ [_literal] :string | [ string, ...string[] ] } & object ;
export function commentFor (this :void, key :string) :symbol;
export const commentForThis :unique symbol;
export { OffsetDateTime, LocalDateTime, LocalDate, LocalTime };
export { exports as default };
}
declare class OffsetDateTime {
readonly toJSON :Date['toJSON'];
readonly toISOString :(this :Readonly<OffsetDateTime>) => `${number}-${number}-${number}T${number}:${number}:${number}${'' | `.${number}`}${'Z' | `${'+' | '-'}${number}:${number}`}`;
readonly valueOf :(this :Readonly<OffsetDateTime>) => `${number}${'' | `.${number}`}`;
private [OffsetDateTime_ISOString] :string;
private [OffsetDateTime_value] :string;
constructor (literal :`${number}-${number}-${number}${'T' | 't' | ' '}${number}:${number}:${number}${'' | `.${number}`}${'Z' | 'z' | `${'+' | '-'}${number}:${number}`}`);
readonly getUTCFullYear :(this :Readonly<OffsetDateTime>) => _1_10000;
readonly getUTCMonth :(this :Readonly<OffsetDateTime>) => _0_11;
readonly getUTCDate :(this :Readonly<OffsetDateTime>) => _1_31;
readonly getUTCHours :(this :Readonly<OffsetDateTime>) => _0_23;
readonly getUTCMinutes :(this :Readonly<OffsetDateTime>) => _0_59;
readonly getUTCSeconds :(this :Readonly<OffsetDateTime>) => _0_59;
readonly getUTCMilliseconds :(this :Readonly<OffsetDateTime>) => _0_999;
readonly getUTCDay :(this :Readonly<OffsetDateTime>) => _0_6;
readonly getTimezoneOffset :(this :Readonly<OffsetDateTime>) => _1439_1439;
readonly getTime :(this :Readonly<OffsetDateTime>) => number;
}
declare class LocalDateTime {
readonly toJSON :Date['toJSON'];
readonly toISOString :(this :Readonly<LocalDateTime>) => `${number}-${number}-${number}T${number}:${number}:${number}${'' | `.${number}`}`;
readonly valueOf :(this :Readonly<LocalDateTime>) => `${number}`;
private [LocalDateTime_ISOString] :string;
private [LocalDateTime_value] :string;
constructor (literal :`${number}-${number}-${number}${'T' | 't' | ' '}${number}:${number}:${number}${'' | `.${number}`}`);
readonly getFullYear :(this :Readonly<LocalDateTime>) => _0_9999;
readonly setFullYear :(this :LocalDateTime, year :_0_9999) => void;
readonly getMonth :(this :Readonly<LocalDateTime>) => _0_11;
readonly setMonth :(this :LocalDateTime, month :_0_11) => void;
readonly getDate :(this :Readonly<LocalDateTime>) => _1_31;
readonly setDate :(this :LocalDateTime, date :_1_31) => void;
readonly getHours :(this :Readonly<LocalDateTime>) => _0_23;
readonly setHours :(this :LocalDateTime, hours :_0_23) => void;
readonly getMinutes :(this :Readonly<LocalDateTime>) => _0_59;
readonly setMinutes :(this :LocalDateTime, min :_0_59) => void;
readonly getSeconds :(this :Readonly<LocalDateTime>) => _0_59;
readonly setSeconds :(this :LocalDateTime, sec :_0_59) => void;
readonly getMilliseconds :(this :Readonly<LocalDateTime>) => _0_999;
readonly setMilliseconds :(this :LocalDateTime, ms :_0_999) => void;
}
declare class LocalDate {
readonly toJSON :Date['toJSON'];
readonly toISOString :(this :Readonly<LocalDate>) => `${number}-${number}-${number}`;
readonly valueOf :(this :Readonly<LocalDate>) => `${number}`;
private [LocalDate_ISOString] :string;
private [LocalDate_value] :string;
constructor (literal :`${number}-${number}-${number}`);
readonly getFullYear :(this :Readonly<LocalDate>) => _0_9999;
readonly setFullYear :(this :LocalDate, year :_0_9999) => void;
readonly getMonth :(this :Readonly<LocalDate>) => _0_11;
readonly setMonth :(this :LocalDate, month :_0_11) => void;
readonly getDate :(this :Readonly<LocalDate>) => _1_31;
readonly setDate :(this :LocalDate, date :_1_31) => void;
}
declare class LocalTime {
readonly toJSON :Date['toJSON'];
readonly toISOString :(this :Readonly<LocalTime>) => `${number}:${number}:${number}${'' | `.${number}`}`;
readonly valueOf :(this :Readonly<LocalTime>) => `${number}`;
private [LocalTime_ISOString] :string;
private [LocalTime_value] :string;
constructor (literal :`${number}:${number}:${number}${'' | `.${number}`}`);
readonly getHours :(this :Readonly<LocalTime>) => _0_23;
readonly setHours :(this :LocalTime, hours :_0_23) => void;
readonly getMinutes :(this :Readonly<LocalTime>) => _0_59;
readonly setMinutes :(this :LocalTime, min :_0_59) => void;
readonly getSeconds :(this :Readonly<LocalTime>) => _0_59;
readonly setSeconds :(this :LocalTime, sec :_0_59) => void;
readonly getMilliseconds :(this :Readonly<LocalTime>) => _0_999;
readonly setMilliseconds :(this :LocalTime, ms :_0_999) => void;
}
export class Keys extends RegExp {
readonly lastIndex :number;
constructor (keys :ArrayLike<string>);
readonly test :(this :Keys, key :string) => boolean;
}
declare const _literal :unique symbol;
type Source = string | ArrayBufferLike
| {
readonly path :string,
readonly data? :undefined,
readonly require :
| {
readonly resolve? :{ readonly paths? :undefined }
(this :void, id :'fs') :{
readonly readFileSync :(this :void, path :string) => ArrayBufferLike
}
}
| {
readonly resolve :{ readonly paths :(this :void, request :string) => null | string[] }
(this :void, id :'path') :{
readonly resolve :(this :void, dirname :string, filename :string) => string
}
(this :void, id :'fs') :{
readonly readFileSync :(this :void, path :string) => ArrayBufferLike
}
},
}
| {
readonly path :string,
readonly data :string | ArrayBufferLike,
readonly require? :
| {
readonly resolve? :{ readonly paths? :undefined }
}
| {
readonly resolve :{ readonly paths :(this :void, request :string) => null | string[] }
(this :void, id :'path') :{
readonly resolve :(this :void, dirname :string, filename :string) => string
}
},
};
type XOptions = null | {
readonly keys? :null | Keys,
readonly order? :boolean,
readonly exact? :boolean,
readonly multi? :boolean,
readonly longer? :boolean,
readonly string? :boolean,
readonly comment? :boolean,
readonly literal? :boolean,
readonly null? :boolean,
readonly tag? :null | (
<Table extends object & { [key :string | symbol] :any }, Key extends string | symbol, Array extends any[], Index extends number, Tag extends string>
(this :void, each :
| { table :Table, key :Key, tag :Tag }
| { array :Array, index :Index, tag :Tag }
| { table :Table, key :Key, array :Array, index :Index, tag :Tag }
) => void
),
};
type ReadonlyTable = object & { readonly [key :string] :ReadonlyValue };
type ReadonlyArray = readonly ReadonlyValue[];
type ReadonlyValue =
| { readonly [_literal] :string | readonly [ string, ...string[] ] } & object
| null | boolean | bigint | number | string
| ReadonlyDatetime | ReadonlyArray | ReadonlyTable
;
interface ReadonlyDatetime { readonly toISOString :(this :this) => string }
type Table = object & { [key :string] :Value };
type Array = Value[];
type Value =
| object & BigInt & { [_literal] :string }
| object & Number & { [_literal] :string }
| object & String & { [_literal] :string | [ string, ...string[] ] }
| null | boolean | bigint | number | string
| Datetime | Array | Table
;
type Datetime = OffsetDateTime | LocalDateTime | LocalDate | LocalTime;
declare const OffsetDateTime_ISOString :unique symbol;
declare const OffsetDateTime_value :unique symbol;
declare const LocalDateTime_ISOString :unique symbol;
declare const LocalDateTime_value :unique symbol;
declare const LocalDate_ISOString :unique symbol;
declare const LocalDate_value :unique symbol;
declare const LocalTime_ISOString :unique symbol;
declare const LocalTime_value :unique symbol;
type _1439_1439 = -1439 | {} & number | 1439;
type _1_10000 = -1 | {} & number | 10000;
type _0_9999 = 0 | {} & number | 9999;
type _0_999 = 0 | {} & number | 999;
type _0_6 = 0 | 1 | 2 | 3 | 4 | 5 | 6;
type _0_11 = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11;
type _0_23 = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23;
type _1_31 = | 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;
type _0_59 = 0 | 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;