@moddable/typings 7.0.0 → 7.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/ChatAudioIO.d.ts +2 -1
  2. package/base64.d.ts +1 -1
  3. package/commodetto/Bitmap.d.ts +5 -1
  4. package/commodetto/BufferOut.d.ts +2 -2
  5. package/commodetto/Convert.d.ts +3 -3
  6. package/commodetto/ReadGIF.d.ts +1 -1
  7. package/commodetto/ReadPNG.d.ts +2 -2
  8. package/commodetto/loadJPEG.d.ts +1 -1
  9. package/commodetto/parseBMF.d.ts +1 -1
  10. package/commodetto/parseNFNT.d.ts +1 -1
  11. package/commodetto/readJPEG.d.ts +2 -2
  12. package/crc.d.ts +2 -2
  13. package/deflate.d.ts +1 -1
  14. package/display.d.ts +1 -1
  15. package/dns/parser.d.ts +1 -1
  16. package/embedded/display.d.ts +2 -2
  17. package/embedded/storage/files.d.ts +2 -2
  18. package/embedded/storage/flash.d.ts +2 -2
  19. package/embedded/storage/key-value.d.ts +4 -3
  20. package/embedded_io/_common.d.ts +0 -1
  21. package/embedded_io/audio/in.d.ts +1 -3
  22. package/embedded_io/audio/out.d.ts +1 -3
  23. package/embedded_io/ble/central.d.ts +3 -4
  24. package/embedded_io/ble/peripheral.d.ts +6 -7
  25. package/embedded_io/i2c.d.ts +3 -3
  26. package/embedded_io/serial.d.ts +3 -3
  27. package/embedded_io/smbus.d.ts +2 -3
  28. package/embedded_io/socket/tcp.d.ts +2 -3
  29. package/embedded_io/socket/udp.d.ts +1 -2
  30. package/embedded_io/spi.d.ts +4 -4
  31. package/embedded_network/http/client.d.ts +7 -8
  32. package/embedded_network/mqtt/client.d.ts +4 -6
  33. package/embedded_network/websocket/client.d.ts +74 -0
  34. package/flash.d.ts +1 -1
  35. package/global.d.ts +10 -7
  36. package/hex.d.ts +1 -1
  37. package/inflate.d.ts +1 -1
  38. package/package.json +1 -1
  39. package/pebble/accelerometer.d.ts +46 -0
  40. package/pebble/battery.d.ts +38 -0
  41. package/pebble/button.d.ts +40 -0
  42. package/pebble/compass.d.ts +40 -0
  43. package/pebble/device.d.ts +51 -0
  44. package/pebble/global.d.ts +128 -0
  45. package/pebble/location.d.ts +50 -0
  46. package/pebble/message.d.ts +46 -0
  47. package/pebble/piu.d.ts +97 -0
  48. package/pebble/poco.d.ts +79 -0
  49. package/pins/audioout.d.ts +1 -1
  50. package/piu/MC-types.d.ts +543 -0
  51. package/piu/MC.d.ts +78 -526
  52. package/qrcode.d.ts +6 -4
  53. package/securesocket.d.ts +1 -1
  54. package/socket.d.ts +1 -1
  55. package/web/fetch.d.ts +28 -0
  56. package/{url.d.ts → web/url.d.ts} +1 -1
  57. package/web/websocket.d.ts +62 -0
  58. package/web/webstorage.d.ts +11 -0
  59. package/xs.d.ts +3 -3
  60. package/zip.d.ts +1 -1
  61. /package/{headers.d.ts → web/headers.d.ts} +0 -0
  62. /package/{structuredClone.d.ts → web/structuredClone.d.ts} +0 -0
  63. /package/{worker.d.ts → web/worker.d.ts} +0 -0
package/piu/MC.d.ts CHANGED
@@ -18,534 +18,11 @@
18
18
  *
19
19
  */
20
20
 
21
+ /// <reference path="./MC-types.d.ts" />
22
+
21
23
  declare module "piu/MC" {
22
24
  import {} from "commodetto/Poco"; // for global screen
23
25
 
24
- /* type aliases */
25
- type Coordinates = {
26
- top?: number;
27
- right?: number;
28
- bottom?: number;
29
- left?: number;
30
- };
31
- type Position = {
32
- x?: number;
33
- y?: number;
34
- };
35
- type Size = {
36
- width?: number;
37
- height?: number;
38
- };
39
- type Bounds = Position & Size;
40
- type Color = string;
41
- type ContentState = {
42
- state?: number;
43
- variant?: number;
44
- };
45
- type TimeProperty = {
46
- time?: number;
47
- duration?: number;
48
- fraction?: number;
49
- interval?: number;
50
- loop?: boolean;
51
- };
52
- type TouchProperty = {
53
- active?: boolean;
54
- backgroundTouch?: boolean;
55
- exclusiveTouch?: boolean;
56
- multipleTouch?: boolean;
57
- };
58
-
59
- // TODO: more accurate constructor parameters
60
- type TemplateStyle<P, C extends new (...args: any) => any> = {
61
- new (dictionary?: P): InstanceType<C>;
62
- template: TemplateStyleFactory<C>;
63
- };
64
- type TemplateStyleFactory<T extends new (...args: any) => any> = (
65
- param: ConstructorParameters<T>[0]
66
- ) => TemplateStyle<Partial<ConstructorParameters<T>[1]>, T>;
67
-
68
- type TemplateComponent<P, C extends new (...args: any) => any> = {
69
- new (behaviorData?: any, dictionary?: P): InstanceType<C>;
70
- template: TemplateComponentFactory<C>;
71
- };
72
- type TemplateComponentFactory<T extends new (...args: any) => any> = (
73
- func: (param: any) => ConstructorParameters<T>[1]
74
- ) => TemplateComponent<Parameters<typeof func>[0], T>;
75
-
76
- interface Behavior<T extends Content = Content>{
77
- onCreate?(content: T, data: object, context: any): void;
78
- onDisplaying?(content: T): void;
79
- onFinished?(content: T): void;
80
- onTimeChanged?(content: T): void;
81
- onTouchBegan?(content: T, id: number, x: number, y: number, ticks: number): void;
82
- onTouchCancelled?(content: T, id: number): void;
83
- onTouchended?( content: T, id: number, x: number, y: number, ticks: number): void;
84
- onTouchMoved?( content: T, id: number, x: number, y: number, ticks: number): void;
85
- // TODO: complete callbacks
86
- }
87
-
88
- interface BehaviorConstructor<T extends Content = Content> {
89
- new(): Behavior<T>;
90
- }
91
-
92
- interface Content {
93
- // TODO: consider type parameter to avoid any
94
- adjust(x: number, y: number): void;
95
- bubble(id: string, ...extras: any[]): void;
96
- captureTouch(id: string, x: number, y: number, ticks: number): void;
97
- defer(id: string, ...extras: any[]): void;
98
- delegate(id: string, ...extras: any[]): void;
99
- distribute(id: string, ...extras: any[]): void;
100
- focus(): void;
101
- hit(x: number, y: number): Content | undefined;
102
- measure(): Size;
103
- moveBy(x: number, y: number): void;
104
- render(): void;
105
- sizeBy(width: number, height: number): void;
106
- start(): void;
107
- stop(): void;
108
-
109
- readonly previous: Content | null;
110
- readonly next: Content | null;
111
- readonly container: Container | null;
112
- readonly index: number;
113
- name: string;
114
- active: boolean;
115
- anchor: string;
116
- behavior: object;
117
- coordinates: Coordinates;
118
- bounds: Bounds;
119
- backgroundTouch: boolean;
120
- exclusiveTouch: boolean;
121
- multipleTouch: boolean;
122
-
123
- time: number;
124
- duration: number;
125
- fraction: number;
126
- interval: number;
127
- loop: boolean;
128
- running: boolean;
129
- offset: undefined | Position;
130
- position: undefined | Position;
131
- size: Size;
132
- state: number;
133
- variant: number;
134
- skin: Skin | null;
135
- style: Style | null;
136
- visible: boolean;
137
- x: number;
138
- y: number;
139
- width: number;
140
- height: number;
141
- }
142
- interface ContentDictionary
143
- extends Coordinates,
144
- Size,
145
- ContentState,
146
- TimeProperty,
147
- TouchProperty {
148
- name?: string;
149
- anchor?: string;
150
- Behavior?: BehaviorConstructor;
151
- skin?: Skin | SkinDictionary;
152
- Skin?: SkinConstructor;
153
- style?: Style | StyleDictionary;
154
- Style?: StyleConstructor;
155
- visible?: boolean;
156
- }
157
- interface ContentConstructor {
158
- new(behaviorData?: any, dictionary?: ContentDictionary): Content;
159
- (behaviorData?: any, dictionary?: ContentDictionary): Content;
160
- readonly prototype: Content;
161
-
162
- template: TemplateComponentFactory<typeof Content>;
163
- }
164
-
165
- interface Style {
166
- measure(string: string): Size;
167
- }
168
- interface StyleDictionaryBase {
169
- color?: Color | Color[];
170
- font?: string;
171
- horizontal?: string;
172
- top?: number;
173
- }
174
- interface StyleConstructor {
175
- new(dictionary: StyleDictionary): Style;
176
-
177
- template<T>(this: T, dictionary: StyleDictionary): T;
178
- }
179
-
180
- interface TextStyleDictionary extends StyleDictionaryBase {
181
- leading?: number;
182
- right?: number;
183
- bottom?: number;
184
- left?: number;
185
- }
186
- interface LabelStyleDictionary extends StyleDictionaryBase {
187
- vertical?: string;
188
- }
189
- type StyleDictionary = LabelStyleDictionary | TextStyleDictionary;
190
-
191
- interface Texture {
192
- readonly height: number;
193
- readonly width: number;
194
- }
195
- interface TextureDictionary {
196
- path: string;
197
- }
198
- interface TextureConstructor {
199
- new(path: string): Texture;
200
- new(dictionary: TextureDictionary): Texture;
201
- readonly prototype: Texture;
202
-
203
- template: TemplateStyleFactory<typeof Texture>;
204
- }
205
-
206
- interface Skin {
207
- borders: Coordinates;
208
- fill: Color | Color[];
209
- stroke: Color | Color[];
210
- texture: Texture;
211
- color: Color;
212
- bounds: Bounds;
213
- height: number;
214
- width: number;
215
- states?: number;
216
- variants?: number;
217
- tiles?: Coordinates;
218
- top?: number;
219
- right?: number;
220
- bottom?: number;
221
- left?: number;
222
- }
223
- interface SkinConstructor {
224
- new(dictionary: SkinDictionary): Skin;
225
- readonly prototype: Skin;
226
-
227
- template: TemplateStyleFactory<typeof Skin>;
228
- }
229
-
230
- interface TextureSkinDictionary extends Coordinates, Bounds {
231
- texture?: Texture | TextureDictionary;
232
- Texture?: TextureConstructor;
233
- color?: Color | Color[];
234
- states?: number;
235
- variants?: number;
236
- tiles?: Coordinates;
237
- }
238
- interface ColorSkinDictionary {
239
- borders?: Coordinates;
240
- fill?: Color | Color[];
241
- stroke?: Color | Color[];
242
- }
243
- type SkinDictionary = ColorSkinDictionary | TextureSkinDictionary;
244
-
245
- interface Transition {
246
- onBegin(container: Container, ...extras: any[]): void;
247
- onEnd(container: Container, ...extras: any[]): void;
248
- onStep(fraction: number): void;
249
- duration?: number;
250
- }
251
- interface TransitionConstructor {
252
- new(duration: number, interpolator?: (value: number) => number, first?: any, last?: any): Transition
253
- }
254
-
255
- interface Container extends Content {
256
- clip: boolean;
257
- readonly first: Content | null;
258
- readonly last: Content | null;
259
- readonly length: number;
260
- readonly transitioning: boolean;
261
- add(content: Content): void;
262
- content(at: number | string): Content | undefined;
263
- empty(start?: number, stop?: number): void;
264
- firstThat(id: string, ...extras: any[]): void;
265
- insert(content: Content, before: Content): void;
266
- lastThat(id: string, ...extras: any[]): void;
267
- remove(content: Content): void;
268
- replace(content: Content, by: Content): void;
269
- run(transition: Transition, ...extras: any[]): void;
270
- swap(content0: Content, content1: Content): void;
271
- onTransitionBeginning(container: Container): void;
272
- onTransitionEnded(container: Container): void;
273
- }
274
- interface ContainerDictionary extends ContentDictionary {
275
- clip?: boolean;
276
- contents?: Content[];
277
- }
278
- interface ContainerConstructor {
279
- new(behaviorData?: any, dictionary?: ContainerDictionary): Container;
280
- (behaviorData?: any, dictionary?: ContainerDictionary): Container;
281
-
282
- template<T>(this: T, fn: (arg: any) => ContainerDictionary): T;
283
- }
284
-
285
- interface Label extends Content {
286
- string: string;
287
- }
288
- interface LabelDictionary extends ContentDictionary {
289
- string?: string;
290
- }
291
- interface LabelConstructor {
292
- new(behaviorData?: any, dictionary?: LabelDictionary): Label;
293
- (behaviorData?: any, dictionary?: LabelDictionary): Label;
294
-
295
- template<T>(this: T, fn: (arg: any) => LabelDictionary): T;
296
- }
297
-
298
- interface Port extends Content {
299
- drawContent(
300
- x: number,
301
- y: number,
302
- width: number,
303
- height: number
304
- ): void;
305
- drawLabel(
306
- string: string,
307
- x: number,
308
- y: number,
309
- width: number,
310
- height: number
311
- ): void;
312
- drawSkin(
313
- skin: Skin,
314
- x: number,
315
- y: number,
316
- width: number,
317
- height: number,
318
- variant?: number,
319
- state?: number
320
- ): void;
321
- drawString(
322
- string: string,
323
- style: Style,
324
- color: Color,
325
- x: number,
326
- y: number,
327
- width: number,
328
- height: number
329
- ): void;
330
- drawStyle(
331
- string: string,
332
- style: Style,
333
- x: number,
334
- y: number,
335
- width: number,
336
- height: number,
337
- ellipsis?: boolean,
338
- state?: number
339
- ): void;
340
- drawTexture(
341
- texture: Texture,
342
- color: Color,
343
- x: number,
344
- y: number,
345
- sx: number,
346
- sy: number,
347
- sw: number,
348
- sh: number
349
- ): void;
350
- fillColor(
351
- color: Color,
352
- x: number,
353
- y: number,
354
- width: number,
355
- height: number
356
- ): void;
357
- fillTexture(
358
- texture: Texture,
359
- color: Color,
360
- x: number,
361
- y: number,
362
- width: number,
363
- height: number,
364
- sx?: number,
365
- sy?: number,
366
- sw?: number,
367
- sh?: number
368
- ): void;
369
- invalidate(
370
- x?: number,
371
- y?: number,
372
- width?: number,
373
- height?: number
374
- ): void;
375
- measureString(string: string, style: Style): Size;
376
- popClip(): void;
377
- pushClip(
378
- x?: number,
379
- y?: number,
380
- width?: number,
381
- height?: number
382
- ): void;
383
- onDraw(
384
- port: Port,
385
- x: number,
386
- y: number,
387
- width: number,
388
- height: number
389
- ): void;
390
- }
391
- interface PortConstructor extends ContentConstructor {
392
- }
393
-
394
- interface TextBlock {
395
- behavior?: object | null;
396
- style?: Style | null;
397
- spans: (string | TextSpan)[] | string,
398
- }
399
-
400
- interface TextSpan extends TextBlock {
401
- link?: any
402
- }
403
-
404
- interface Text extends Content {
405
- blocks: TextBlock[],
406
- string: string;
407
- begin(): void;
408
- beginBlock(style?: Style, behavior?: object): void;
409
- beginSpan(style: Style, behavior?: object): void;
410
- concat(string: string): void;
411
- end(): void;
412
- endBlock(): void;
413
- endSpan(): void;
414
- }
415
- interface TextDictionary extends ContentDictionary {
416
- blocks?: TextBlock[],
417
- string?: string;
418
- }
419
- interface TextConstructor {
420
- new(behaviorData?: any, dictionary?: TextDictionary): Text;
421
- (behaviorData?: any, dictionary?: TextDictionary): Text;
422
-
423
- template<T>(this: T, fn: (arg: any) => TextDictionary): T;
424
- }
425
-
426
- interface Application extends Container {
427
- displayListLength: number;
428
- commandListLength: number;
429
- touchCount: number;
430
- }
431
- interface ApplicationDictionary extends ContainerDictionary {
432
- displayListLength?: number;
433
- commandListLength?: number;
434
- touchCount?: number;
435
- pixels?: number;
436
- }
437
- interface ApplicationConstructor {
438
- new(behaviorData?: any, dictionary?: ApplicationDictionary): Application;
439
-
440
- template<T>(this: T, fn: (arg: any) => ApplicationDictionary): T;
441
- }
442
-
443
- interface Column extends Container {
444
- }
445
- interface ColumnConstructor extends ContainerConstructor {
446
- }
447
-
448
- interface Layout extends Container {
449
- onFitHorizontally(layout: Layout, width: number): void;
450
- onFitVertically(layout: Layout, height: number): void;
451
- onMeasureHorizontally(layout: Layout, width: number): void;
452
- onMeasureVertically(layout: Layout, height: number): void;
453
- }
454
- interface LayoutConstructor extends ContainerConstructor {
455
- }
456
-
457
- interface Image extends Content {
458
- readonly frameCount: never;
459
- frameIndex: number;
460
- }
461
- interface ImageDictionary extends ContentDictionary {
462
- path: string;
463
- }
464
- interface ImageConstructor {
465
- new(behaviorData?: any, dictionary?: ImageDictionary): Image;
466
- (behaviorData?: any, dictionary?: ImageDictionary): Image;
467
-
468
- template<T>(this: T, fn: (arg: any) => ImageDictionary): T;
469
- }
470
-
471
- interface Die extends Layout {
472
- set(x: number, y: number, width: number, height: number): Die;
473
- sub(x: number, y: number, width: number, height: number): Die;
474
- and(x: number, y: number, width: number, height: number): Die;
475
- or(x: number, y: number, width: number, height: number): Die;
476
- xor(x: number, y: number, width: number, height: number): Die;
477
- fill(): Die;
478
- empty(): Die;
479
- cut(): void;
480
- attach(content: Content): void;
481
- detach(): void;
482
- }
483
- interface DieConstructor extends LayoutConstructor {
484
- }
485
-
486
- interface Row extends Container {
487
- }
488
- interface RowConstructor extends ContainerConstructor {
489
- }
490
-
491
- interface Scroller extends Container {
492
- readonly constraint: Position;
493
- loop: boolean;
494
- scroll: Position;
495
- tracking: boolean;
496
- reveal(bounds: Bounds): void;
497
- scrollBy(dx: number, dy: number): void;
498
- scrollTo(x: number, y: number): void;
499
- onScrolled(scroller: Scroller): void;
500
- }
501
- interface ScrollerDictionary extends ContainerDictionary {
502
- loop?: boolean;
503
- }
504
- interface ScrollerConstructor {
505
- new(behaviorData?: any, dictionary?: ScrollerDictionary): Scroller;
506
- (behaviorData?: any, dictionary?: ScrollerDictionary): Scroller;
507
-
508
- template<T>(this: T, fn: (arg: any) => ScrollerDictionary): T;
509
- }
510
-
511
- interface LinkDictionary {
512
- Behavior?: BehaviorConstructor;
513
- }
514
- interface Link {
515
- readonly container: Container;
516
- state: number;
517
- captureTouch(id: number, x: number, y: number, ticks: number): void;
518
- }
519
- interface LinkConstructor {
520
- new(behaviorData?: any, dictionary?: LinkDictionary): Link;
521
- (behaviorData?: any, dictionary?: LinkDictionary): Link;
522
-
523
- template<T>(this: T, fn: (arg: any) => LinkDictionary): T;
524
- }
525
-
526
- interface Locals {
527
- new(name?: string, language?: string): Locals
528
- language: string;
529
- get(textToLocalize: string): string
530
- }
531
-
532
- interface blendColors {
533
- (a: number, c1: number, c2: number): Color
534
- }
535
- interface hsl {
536
- (h: number, s: number, l: number): Color
537
- }
538
- interface hsla {
539
- (h: number, s: number, l: number, a: number): Color
540
- }
541
- interface rgb {
542
- (r: number, g: number, b: number): Color
543
- }
544
- interface rgba {
545
- (r: number, g: number, b: number, a: number): Color
546
- }
547
-
548
-
549
26
  global {
550
27
  const Skin: SkinConstructor
551
28
  const Texture: TextureConstructor
@@ -573,4 +50,79 @@ interface BehaviorConstructor<T extends Content = Content> {
573
50
  const rgb: rgb
574
51
  const rgba: rgba
575
52
  }
576
- }
53
+
54
+ export {
55
+ Coordinates,
56
+ Position,
57
+ Size,
58
+ Bounds,
59
+ Color,
60
+ ContentState,
61
+ TimeProperty,
62
+ TouchProperty,
63
+ TemplateStyle,
64
+ TemplateStyleFactory,
65
+ TemplateComponent,
66
+ TemplateComponentFactory,
67
+ Behavior,
68
+ BehaviorConstructor,
69
+ Content,
70
+ ContentDictionary,
71
+ ContentConstructor,
72
+ Style,
73
+ StyleDictionaryBase,
74
+ StyleConstructor,
75
+ TextStyleDictionary,
76
+ LabelStyleDictionary,
77
+ StyleDictionary,
78
+ Texture,
79
+ TextureDictionary,
80
+ TextureConstructor,
81
+ Skin,
82
+ SkinConstructor,
83
+ TextureSkinDictionary,
84
+ ColorSkinDictionary,
85
+ SkinDictionary,
86
+ Transition,
87
+ TransitionConstructor,
88
+ Container,
89
+ ContainerDictionary,
90
+ ContainerConstructor,
91
+ Label,
92
+ LabelDictionary,
93
+ LabelConstructor,
94
+ Port,
95
+ PortConstructor,
96
+ TextBlock,
97
+ TextSpan,
98
+ Text,
99
+ TextDictionary,
100
+ TextConstructor,
101
+ Application,
102
+ ApplicationDictionary,
103
+ ApplicationConstructor,
104
+ Column,
105
+ ColumnConstructor,
106
+ Layout,
107
+ LayoutConstructor,
108
+ Image,
109
+ ImageDictionary,
110
+ ImageConstructor,
111
+ Die,
112
+ DieConstructor,
113
+ Row,
114
+ RowConstructor,
115
+ Scroller,
116
+ ScrollerDictionary,
117
+ ScrollerConstructor,
118
+ LinkDictionary,
119
+ Link,
120
+ LinkConstructor,
121
+ Locals,
122
+ blendColors,
123
+ hsl,
124
+ hsla,
125
+ rgb,
126
+ rgba,
127
+ }
128
+ }
package/qrcode.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2024 Satoshi Tanaka
2
+ * Copyright (c) 2024-2026 Satoshi Tanaka
3
3
  *
4
4
  * This file is part of the Moddable SDK Tools.
5
5
  *
@@ -23,9 +23,11 @@ declare module "qrcode" {
23
23
  size: number;
24
24
  }
25
25
 
26
- var qrCode: (options: {
27
- input: string | BufferLike,
28
- maxVersion?: number
26
+ const qrCode: (options: {
27
+ input: string | ByteBuffer,
28
+ maxVersion?: number,
29
+ bitmap?: number | boolean,
30
+ fit?: number,
29
31
  }) => qrcode;
30
32
 
31
33
  export { qrCode as default };
package/securesocket.d.ts CHANGED
@@ -21,7 +21,7 @@
21
21
  declare module "securesocket" {
22
22
  import { Socket } from "socket";
23
23
 
24
- type WriteData = number | string | BufferLike;
24
+ type WriteData = number | string | ByteBuffer;
25
25
 
26
26
  export default class SecureSocket {
27
27
  sock: typeof Socket;
package/socket.d.ts CHANGED
@@ -44,7 +44,7 @@ declare module "socket" {
44
44
  port: number,
45
45
  kind: "UDP",
46
46
  };
47
- type WriteData = number | string | BufferLike;
47
+ type WriteData = number | string | ByteBuffer;
48
48
 
49
49
  type MessageError = -2;
50
50
  type MessageDisconnect = -1;
package/web/fetch.d.ts ADDED
@@ -0,0 +1,28 @@
1
+ declare module "web/fetch" {
2
+ import {URL, URLSearchParams} from "url"
3
+ import Headers from "headers"
4
+
5
+ class Response {
6
+ get bodyUsed(): boolean;
7
+ get headers(): Headers;
8
+ get ok(): boolean;
9
+ get redirected(): boolean;
10
+ get status(): number;
11
+ get statusText(): string;
12
+ get url(): string;
13
+ arrayBuffer(): Promise<ArrayBuffer>;
14
+ json(): Promise<any>;
15
+ text(): Promise<string>;
16
+ }
17
+
18
+ interface RequestInit {
19
+ method?: string;
20
+ headers?: Headers | Record<string, string>;
21
+ body?: string | ByteBuffer | URLSearchParams;
22
+ }
23
+
24
+ function fetch(resource: string | URL, options?: RequestInit): Promise<Response>;
25
+
26
+ export { fetch };
27
+ export default fetch;
28
+ }
@@ -39,7 +39,7 @@ declare module "url" {
39
39
  }
40
40
 
41
41
  class URLSearchParams implements Iterable<[string, string]>{
42
- constructor(it?: string[][] | Record<string, string> | string)
42
+ constructor(it?: string[][] | Record<string, { toString(): string }> | string)
43
43
  readonly length: number;
44
44
  append(name: string, value: string): void;
45
45
  delete(name: string, value?: string): void;