@types/node 18.16.19 → 18.17.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 (111) hide show
  1. {node v18.16 → node v18.17}/README.md +1 -1
  2. {node v18.16/ts4.8 → node v18.17}/dns.d.ts +8 -0
  3. {node v18.16 → node v18.17}/events.d.ts +29 -0
  4. {node v18.16 → node v18.17}/fs/promises.d.ts +12 -1
  5. {node v18.16 → node v18.17}/fs.d.ts +16 -0
  6. {node v18.16 → node v18.17}/http.d.ts +7 -0
  7. {node v18.16/ts4.8 → node v18.17}/http2.d.ts +1 -1
  8. {node v18.16 → node v18.17}/index.d.ts +1 -1
  9. {node v18.16 → node v18.17}/package.json +2 -2
  10. {node v18.16 → node v18.17}/stream.d.ts +14 -0
  11. {node v18.16 → node v18.17}/test.d.ts +235 -116
  12. {node v18.16 → node v18.17/ts4.8}/dns.d.ts +8 -0
  13. {node v18.16 → node v18.17}/ts4.8/events.d.ts +29 -0
  14. {node v18.16 → node v18.17}/ts4.8/fs/promises.d.ts +33 -1
  15. {node v18.16 → node v18.17}/ts4.8/fs.d.ts +118 -1
  16. {node v18.16 → node v18.17}/ts4.8/http.d.ts +73 -3
  17. {node v18.16 → node v18.17/ts4.8}/http2.d.ts +1 -1
  18. {node v18.16 → node v18.17}/ts4.8/stream.d.ts +17 -3
  19. {node v18.16 → node v18.17}/ts4.8/test.d.ts +235 -117
  20. {node v18.16 → node v18.17}/ts4.8/url.d.ts +14 -0
  21. {node v18.16 → node v18.17}/url.d.ts +14 -0
  22. {node v18.16 → node v18.17}/LICENSE +0 -0
  23. {node v18.16 → node v18.17}/assert/strict.d.ts +0 -0
  24. {node v18.16 → node v18.17}/assert.d.ts +0 -0
  25. {node v18.16 → node v18.17}/async_hooks.d.ts +0 -0
  26. {node v18.16 → node v18.17}/buffer.d.ts +0 -0
  27. {node v18.16 → node v18.17}/child_process.d.ts +0 -0
  28. {node v18.16 → node v18.17}/cluster.d.ts +0 -0
  29. {node v18.16 → node v18.17}/console.d.ts +0 -0
  30. {node v18.16 → node v18.17}/constants.d.ts +0 -0
  31. {node v18.16 → node v18.17}/crypto.d.ts +0 -0
  32. {node v18.16 → node v18.17}/dgram.d.ts +0 -0
  33. {node v18.16 → node v18.17}/diagnostics_channel.d.ts +0 -0
  34. {node v18.16 → node v18.17}/dns/promises.d.ts +0 -0
  35. {node v18.16 → node v18.17}/dom-events.d.ts +0 -0
  36. {node v18.16 → node v18.17}/domain.d.ts +0 -0
  37. {node v18.16 → node v18.17}/globals.d.ts +0 -0
  38. {node v18.16 → node v18.17}/globals.global.d.ts +0 -0
  39. {node v18.16 → node v18.17}/https.d.ts +0 -0
  40. {node v18.16 → node v18.17}/inspector.d.ts +0 -0
  41. {node v18.16 → node v18.17}/module.d.ts +0 -0
  42. {node v18.16 → node v18.17}/net.d.ts +0 -0
  43. {node v18.16 → node v18.17}/os.d.ts +0 -0
  44. {node v18.16 → node v18.17}/path.d.ts +0 -0
  45. {node v18.16 → node v18.17}/perf_hooks.d.ts +0 -0
  46. {node v18.16 → node v18.17}/process.d.ts +0 -0
  47. {node v18.16 → node v18.17}/punycode.d.ts +0 -0
  48. {node v18.16 → node v18.17}/querystring.d.ts +0 -0
  49. {node v18.16 → node v18.17}/readline/promises.d.ts +0 -0
  50. {node v18.16 → node v18.17}/readline.d.ts +0 -0
  51. {node v18.16 → node v18.17}/repl.d.ts +0 -0
  52. {node v18.16 → node v18.17}/stream/consumers.d.ts +0 -0
  53. {node v18.16 → node v18.17}/stream/promises.d.ts +0 -0
  54. {node v18.16 → node v18.17}/stream/web.d.ts +0 -0
  55. {node v18.16 → node v18.17}/string_decoder.d.ts +0 -0
  56. {node v18.16 → node v18.17}/timers/promises.d.ts +0 -0
  57. {node v18.16 → node v18.17}/timers.d.ts +0 -0
  58. {node v18.16 → node v18.17}/tls.d.ts +0 -0
  59. {node v18.16 → node v18.17}/trace_events.d.ts +0 -0
  60. {node v18.16 → node v18.17}/ts4.8/assert/strict.d.ts +0 -0
  61. {node v18.16 → node v18.17}/ts4.8/assert.d.ts +0 -0
  62. {node v18.16 → node v18.17}/ts4.8/async_hooks.d.ts +0 -0
  63. {node v18.16 → node v18.17}/ts4.8/buffer.d.ts +0 -0
  64. {node v18.16 → node v18.17}/ts4.8/child_process.d.ts +0 -0
  65. {node v18.16 → node v18.17}/ts4.8/cluster.d.ts +0 -0
  66. {node v18.16 → node v18.17}/ts4.8/console.d.ts +0 -0
  67. {node v18.16 → node v18.17}/ts4.8/constants.d.ts +0 -0
  68. {node v18.16 → node v18.17}/ts4.8/crypto.d.ts +0 -0
  69. {node v18.16 → node v18.17}/ts4.8/dgram.d.ts +0 -0
  70. {node v18.16 → node v18.17}/ts4.8/diagnostics_channel.d.ts +0 -0
  71. {node v18.16 → node v18.17}/ts4.8/dns/promises.d.ts +0 -0
  72. {node v18.16 → node v18.17}/ts4.8/dom-events.d.ts +0 -0
  73. {node v18.16 → node v18.17}/ts4.8/domain.d.ts +0 -0
  74. {node v18.16 → node v18.17}/ts4.8/globals.d.ts +0 -0
  75. {node v18.16 → node v18.17}/ts4.8/globals.global.d.ts +0 -0
  76. {node v18.16 → node v18.17}/ts4.8/https.d.ts +0 -0
  77. {node v18.16 → node v18.17}/ts4.8/index.d.ts +0 -0
  78. {node v18.16 → node v18.17}/ts4.8/inspector.d.ts +0 -0
  79. {node v18.16 → node v18.17}/ts4.8/module.d.ts +0 -0
  80. {node v18.16 → node v18.17}/ts4.8/net.d.ts +0 -0
  81. {node v18.16 → node v18.17}/ts4.8/os.d.ts +0 -0
  82. {node v18.16 → node v18.17}/ts4.8/path.d.ts +0 -0
  83. {node v18.16 → node v18.17}/ts4.8/perf_hooks.d.ts +0 -0
  84. {node v18.16 → node v18.17}/ts4.8/process.d.ts +0 -0
  85. {node v18.16 → node v18.17}/ts4.8/punycode.d.ts +0 -0
  86. {node v18.16 → node v18.17}/ts4.8/querystring.d.ts +0 -0
  87. {node v18.16 → node v18.17}/ts4.8/readline/promises.d.ts +0 -0
  88. {node v18.16 → node v18.17}/ts4.8/readline.d.ts +0 -0
  89. {node v18.16 → node v18.17}/ts4.8/repl.d.ts +0 -0
  90. {node v18.16 → node v18.17}/ts4.8/stream/consumers.d.ts +0 -0
  91. {node v18.16 → node v18.17}/ts4.8/stream/promises.d.ts +0 -0
  92. {node v18.16 → node v18.17}/ts4.8/stream/web.d.ts +0 -0
  93. {node v18.16 → node v18.17}/ts4.8/string_decoder.d.ts +0 -0
  94. {node v18.16 → node v18.17}/ts4.8/timers/promises.d.ts +0 -0
  95. {node v18.16 → node v18.17}/ts4.8/timers.d.ts +0 -0
  96. {node v18.16 → node v18.17}/ts4.8/tls.d.ts +0 -0
  97. {node v18.16 → node v18.17}/ts4.8/trace_events.d.ts +0 -0
  98. {node v18.16 → node v18.17}/ts4.8/tty.d.ts +0 -0
  99. {node v18.16 → node v18.17}/ts4.8/util.d.ts +0 -0
  100. {node v18.16 → node v18.17}/ts4.8/v8.d.ts +0 -0
  101. {node v18.16 → node v18.17}/ts4.8/vm.d.ts +0 -0
  102. {node v18.16 → node v18.17}/ts4.8/wasi.d.ts +0 -0
  103. {node v18.16 → node v18.17}/ts4.8/worker_threads.d.ts +0 -0
  104. {node v18.16 → node v18.17}/ts4.8/zlib.d.ts +0 -0
  105. {node v18.16 → node v18.17}/tty.d.ts +0 -0
  106. {node v18.16 → node v18.17}/util.d.ts +0 -0
  107. {node v18.16 → node v18.17}/v8.d.ts +0 -0
  108. {node v18.16 → node v18.17}/vm.d.ts +0 -0
  109. {node v18.16 → node v18.17}/wasi.d.ts +0 -0
  110. {node v18.16 → node v18.17}/worker_threads.d.ts +0 -0
  111. {node v18.16 → node v18.17}/zlib.d.ts +0 -0
@@ -10,7 +10,6 @@ declare module 'node:test' {
10
10
  * @returns A {@link TestsStream} that emits events about the test execution.
11
11
  */
12
12
  function run(options?: RunOptions): TestsStream;
13
-
14
13
  /**
15
14
  * The `test()` function is the value imported from the test module. Each invocation of this
16
15
  * function results in reporting the test to the {@link TestsStream}.
@@ -59,7 +58,10 @@ declare module 'node:test' {
59
58
  it,
60
59
  run,
61
60
  mock,
62
- test
61
+ test,
62
+ skip,
63
+ todo,
64
+ only
63
65
  };
64
66
  }
65
67
  /**
@@ -130,6 +132,30 @@ declare module 'node:test' {
130
132
  function only(options?: TestOptions, fn?: TestFn): void;
131
133
  function only(fn?: TestFn): void;
132
134
  }
135
+ /**
136
+ * Shorthand for skipping a test, same as `test([name], { skip: true }[, fn])`.
137
+ * @since v18.17.0
138
+ */
139
+ function skip(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
140
+ function skip(name?: string, fn?: TestFn): Promise<void>;
141
+ function skip(options?: TestOptions, fn?: TestFn): Promise<void>;
142
+ function skip(fn?: TestFn): Promise<void>;
143
+ /**
144
+ * Shorthand for marking a test as `TODO`, same as `test([name], { todo: true }[, fn])`.
145
+ * @since v18.17.0
146
+ */
147
+ function todo(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
148
+ function todo(name?: string, fn?: TestFn): Promise<void>;
149
+ function todo(options?: TestOptions, fn?: TestFn): Promise<void>;
150
+ function todo(fn?: TestFn): Promise<void>;
151
+ /**
152
+ * Shorthand for marking a test as `only`, same as `test([name], { only: true }[, fn])`.
153
+ * @since v18.17.0
154
+ */
155
+ function only(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
156
+ function only(name?: string, fn?: TestFn): Promise<void>;
157
+ function only(options?: TestOptions, fn?: TestFn): Promise<void>;
158
+ function only(fn?: TestFn): Promise<void>;
133
159
 
134
160
  /**
135
161
  * The type of a function under test. The first argument to this function is a
@@ -193,160 +219,66 @@ declare module 'node:test' {
193
219
  addListener(event: 'test:pass', listener: (data: TestPass) => void): this;
194
220
  addListener(event: 'test:plan', listener: (data: TestPlan) => void): this;
195
221
  addListener(event: 'test:start', listener: (data: TestStart) => void): this;
222
+ addListener(event: 'test:stderr', listener: (data: TestStderr) => void): this;
223
+ addListener(event: 'test:stdout', listener: (data: TestStdout) => void): this;
196
224
  addListener(event: string, listener: (...args: any[]) => void): this;
197
225
  emit(event: 'test:diagnostic', data: DiagnosticData): boolean;
198
226
  emit(event: 'test:fail', data: TestFail): boolean;
199
227
  emit(event: 'test:pass', data: TestPass): boolean;
200
228
  emit(event: 'test:plan', data: TestPlan): boolean;
201
229
  emit(event: 'test:start', data: TestStart): boolean;
230
+ emit(event: 'test:stderr', data: TestStderr): boolean;
231
+ emit(event: 'test:stdout', data: TestStdout): boolean;
202
232
  emit(event: string | symbol, ...args: any[]): boolean;
203
233
  on(event: 'test:diagnostic', listener: (data: DiagnosticData) => void): this;
204
234
  on(event: 'test:fail', listener: (data: TestFail) => void): this;
205
235
  on(event: 'test:pass', listener: (data: TestPass) => void): this;
206
236
  on(event: 'test:plan', listener: (data: TestPlan) => void): this;
207
237
  on(event: 'test:start', listener: (data: TestStart) => void): this;
238
+ on(event: 'test:stderr', listener: (data: TestStderr) => void): this;
239
+ on(event: 'test:stdout', listener: (data: TestStdout) => void): this;
208
240
  on(event: string, listener: (...args: any[]) => void): this;
209
241
  once(event: 'test:diagnostic', listener: (data: DiagnosticData) => void): this;
210
242
  once(event: 'test:fail', listener: (data: TestFail) => void): this;
211
243
  once(event: 'test:pass', listener: (data: TestPass) => void): this;
212
244
  once(event: 'test:plan', listener: (data: TestPlan) => void): this;
213
245
  once(event: 'test:start', listener: (data: TestStart) => void): this;
246
+ once(event: 'test:stderr', listener: (data: TestStderr) => void): this;
247
+ once(event: 'test:stdout', listener: (data: TestStdout) => void): this;
214
248
  once(event: string, listener: (...args: any[]) => void): this;
215
249
  prependListener(event: 'test:diagnostic', listener: (data: DiagnosticData) => void): this;
216
250
  prependListener(event: 'test:fail', listener: (data: TestFail) => void): this;
217
251
  prependListener(event: 'test:pass', listener: (data: TestPass) => void): this;
218
252
  prependListener(event: 'test:plan', listener: (data: TestPlan) => void): this;
219
253
  prependListener(event: 'test:start', listener: (data: TestStart) => void): this;
254
+ prependListener(event: 'test:stderr', listener: (data: TestStderr) => void): this;
255
+ prependListener(event: 'test:stdout', listener: (data: TestStdout) => void): this;
220
256
  prependListener(event: string, listener: (...args: any[]) => void): this;
221
257
  prependOnceListener(event: 'test:diagnostic', listener: (data: DiagnosticData) => void): this;
222
258
  prependOnceListener(event: 'test:fail', listener: (data: TestFail) => void): this;
223
259
  prependOnceListener(event: 'test:pass', listener: (data: TestPass) => void): this;
224
260
  prependOnceListener(event: 'test:plan', listener: (data: TestPlan) => void): this;
225
261
  prependOnceListener(event: 'test:start', listener: (data: TestStart) => void): this;
262
+ prependOnceListener(event: 'test:stderr', listener: (data: TestStderr) => void): this;
263
+ prependOnceListener(event: 'test:stdout', listener: (data: TestStdout) => void): this;
226
264
  prependOnceListener(event: string, listener: (...args: any[]) => void): this;
227
265
  }
228
266
 
229
- interface DiagnosticData {
230
- /**
231
- * The diagnostic message.
232
- */
233
- message: string;
234
-
235
- /**
236
- * The nesting level of the test.
237
- */
238
- nesting: number;
239
- }
240
-
241
- interface TestFail {
242
- /**
243
- * Additional execution metadata.
244
- */
245
- details: {
246
- /**
247
- * The duration of the test in milliseconds.
248
- */
249
- duration: number;
250
-
251
- /**
252
- * The error thrown by the test.
253
- */
254
- error: Error;
255
- };
256
-
257
- /**
258
- * The test name.
259
- */
260
- name: string;
261
-
262
- /**
263
- * The nesting level of the test.
264
- */
265
- nesting: number;
266
-
267
- /**
268
- * The ordinal number of the test.
269
- */
270
- testNumber: number;
271
-
272
- /**
273
- * Present if `context.todo` is called.
274
- */
275
- todo?: string | boolean;
276
-
277
- /**
278
- * Present if `context.skip` is called.
279
- */
280
- skip?: string | boolean;
281
- }
282
-
283
- interface TestPass {
284
- /**
285
- * Additional execution metadata.
286
- */
287
- details: {
288
- /**
289
- * The duration of the test in milliseconds.
290
- */
291
- duration: number;
292
- };
293
-
294
- /**
295
- * The test name.
296
- */
297
- name: string;
298
-
299
- /**
300
- * The nesting level of the test.
301
- */
302
- nesting: number;
303
-
304
- /**
305
- * The ordinal number of the test.
306
- */
307
- testNumber: number;
308
-
309
- /**
310
- * Present if `context.todo` is called.
311
- */
312
- todo?: string | boolean;
313
-
314
- /**
315
- * Present if `context.skip` is called.
316
- */
317
- skip?: string | boolean;
318
- }
319
-
320
- interface TestPlan {
321
- /**
322
- * The nesting level of the test.
323
- */
324
- nesting: number;
325
-
326
- /**
327
- * The number of subtests that have ran.
328
- */
329
- count: number;
330
- }
331
-
332
- interface TestStart {
333
- /**
334
- * The test name.
335
- */
336
- name: string;
337
-
338
- /**
339
- * The nesting level of the test.
340
- */
341
- nesting: number;
342
- }
343
-
344
267
  /**
345
268
  * An instance of `TestContext` is passed to each test function in order to interact with the
346
269
  * test runner. However, the `TestContext` constructor is not exposed as part of the API.
347
270
  * @since v18.0.0
348
271
  */
349
272
  interface TestContext {
273
+ /**
274
+ * This function is used to create a hook running before subtest of the current test.
275
+ * @param fn The hook function. If the hook uses callbacks, the callback function is passed as
276
+ * the second argument. Default: A no-op function.
277
+ * @param options Configuration options for the hook.
278
+ * @since v18.17.0
279
+ */
280
+ before: typeof before;
281
+
350
282
  /**
351
283
  * This function is used to create a hook running before each subtest of the current test.
352
284
  * @param fn The hook function. If the hook uses callbacks, the callback function is passed as
@@ -782,3 +714,189 @@ declare module 'node:test' {
782
714
 
783
715
  export { test as default, run, test, describe, it, before, after, beforeEach, afterEach, mock };
784
716
  }
717
+
718
+ interface DiagnosticData {
719
+ /**
720
+ * The diagnostic message.
721
+ */
722
+ message: string;
723
+ /**
724
+ * The nesting level of the test.
725
+ */
726
+ nesting: number;
727
+ /**
728
+ * The path of the test file, undefined if test is not ran through a file.
729
+ */
730
+ file?: string;
731
+ }
732
+ interface TestFail {
733
+ /**
734
+ * Additional execution metadata.
735
+ */
736
+ details: {
737
+ /**
738
+ * The duration of the test in milliseconds.
739
+ */
740
+ duration: number;
741
+ /**
742
+ * The error thrown by the test.
743
+ */
744
+ error: Error;
745
+ };
746
+ /**
747
+ * The test name.
748
+ */
749
+ name: string;
750
+ /**
751
+ * The nesting level of the test.
752
+ */
753
+ nesting: number;
754
+ /**
755
+ * The ordinal number of the test.
756
+ */
757
+ testNumber: number;
758
+ /**
759
+ * Present if `context.todo` is called.
760
+ */
761
+ todo?: string | boolean;
762
+ /**
763
+ * Present if `context.skip` is called.
764
+ */
765
+ skip?: string | boolean;
766
+ /**
767
+ * The path of the test file, undefined if test is not ran through a file.
768
+ */
769
+ file?: string;
770
+ }
771
+ interface TestPass {
772
+ /**
773
+ * Additional execution metadata.
774
+ */
775
+ details: {
776
+ /**
777
+ * The duration of the test in milliseconds.
778
+ */
779
+ duration: number;
780
+ };
781
+ /**
782
+ * The test name.
783
+ */
784
+ name: string;
785
+ /**
786
+ * The nesting level of the test.
787
+ */
788
+ nesting: number;
789
+ /**
790
+ * The ordinal number of the test.
791
+ */
792
+ testNumber: number;
793
+ /**
794
+ * Present if `context.todo` is called.
795
+ */
796
+ todo?: string | boolean;
797
+ /**
798
+ * Present if `context.skip` is called.
799
+ */
800
+ skip?: string | boolean;
801
+ /**
802
+ * The path of the test file, undefined if test is not ran through a file.
803
+ */
804
+ file?: string;
805
+ }
806
+ interface TestPlan {
807
+ /**
808
+ * The nesting level of the test.
809
+ */
810
+ nesting: number;
811
+ /**
812
+ * The number of subtests that have ran.
813
+ */
814
+ count: number;
815
+ /**
816
+ * The path of the test file, undefined if test is not ran through a file.
817
+ */
818
+ file?: string;
819
+ }
820
+ interface TestStart {
821
+ /**
822
+ * The test name.
823
+ */
824
+ name: string;
825
+ /**
826
+ * The nesting level of the test.
827
+ */
828
+ nesting: number;
829
+ /**
830
+ * The path of the test file, undefined if test is not ran through a file.
831
+ */
832
+ file?: string;
833
+ }
834
+ interface TestStderr {
835
+ /**
836
+ * The path of the test file, undefined if test is not ran through a file.
837
+ */
838
+ file?: string;
839
+ /**
840
+ * The message written to `stderr`
841
+ */
842
+ message: string;
843
+ }
844
+ interface TestStdout {
845
+ /**
846
+ * The path of the test file, undefined if test is not ran through a file.
847
+ */
848
+ file?: string;
849
+ /**
850
+ * The message written to `stdout`
851
+ */
852
+ message: string;
853
+ }
854
+
855
+ /**
856
+ * The `node:test/reporters` module exposes the builtin-reporters for `node:test`.
857
+ * To access it:
858
+ *
859
+ * ```js
860
+ * import test from 'node:test/reporters';
861
+ * ```
862
+ *
863
+ * This module is only available under the `node:` scheme. The following will not
864
+ * work:
865
+ *
866
+ * ```js
867
+ * import test from 'test/reporters';
868
+ * ```
869
+ * @since v18.17.0
870
+ * @see [source](https://github.com/nodejs/node/blob/v18.17.0/lib/test/reporters.js)
871
+ */
872
+ declare module 'node:test/reporters' {
873
+ import { Transform } from 'node:stream';
874
+
875
+ type TestEvent =
876
+ | { type: 'test:diagnostic', data: DiagnosticData }
877
+ | { type: 'test:fail', data: TestFail }
878
+ | { type: 'test:pass', data: TestPass }
879
+ | { type: 'test:plan', data: TestPlan }
880
+ | { type: 'test:start', data: TestStart }
881
+ | { type: 'test:stderr', data: TestStderr }
882
+ | { type: 'test:stdout', data: TestStdout };
883
+ type TestEventGenerator = AsyncGenerator<TestEvent, void>;
884
+
885
+ /**
886
+ * The `dot` reporter outputs the test results in a compact format,
887
+ * where each passing test is represented by a `.`,
888
+ * and each failing test is represented by a `X`.
889
+ */
890
+ function dot(source: TestEventGenerator): AsyncGenerator<'\n' | '.' | 'X', void>;
891
+ /**
892
+ * The `tap` reporter outputs the test results in the [TAP](https://testanything.org/) format.
893
+ */
894
+ function tap(source: TestEventGenerator): AsyncGenerator<string, void>;
895
+ /**
896
+ * The `spec` reporter outputs the test results in a human-readable format.
897
+ */
898
+ class Spec extends Transform {
899
+ constructor();
900
+ }
901
+ export { dot, tap, Spec as spec };
902
+ }
@@ -404,6 +404,20 @@ declare module 'url' {
404
404
  * @param id A `'blob:nodedata:...` URL string returned by a prior call to `URL.createObjectURL()`.
405
405
  */
406
406
  static revokeObjectURL(objectUrl: string): void;
407
+ /**
408
+ * Checks if an `input` relative to the `base` can be parsed to a `URL`.
409
+ *
410
+ * ```js
411
+ * const isValid = URL.canParse('/foo', 'https://example.org/'); // true
412
+ *
413
+ * const isNotValid = URL.canParse('/foo'); // false
414
+ * ```
415
+ * @since v18.17.0
416
+ * @param input The absolute or relative input URL to parse. If `input` is relative, then `base` is required. If `input` is absolute, the `base` is ignored. If `input` is not a string, it is
417
+ * `converted to a string` first.
418
+ * @param base The base URL to resolve against if the `input` is not absolute. If `base` is not a string, it is `converted to a string` first.
419
+ */
420
+ static canParse(input: string, base?: string): boolean;
407
421
  constructor(input: string, base?: string | URL);
408
422
  /**
409
423
  * Gets and sets the fragment portion of the URL.
@@ -404,6 +404,20 @@ declare module 'url' {
404
404
  * @param id A `'blob:nodedata:...` URL string returned by a prior call to `URL.createObjectURL()`.
405
405
  */
406
406
  static revokeObjectURL(objectUrl: string): void;
407
+ /**
408
+ * Checks if an `input` relative to the `base` can be parsed to a `URL`.
409
+ *
410
+ * ```js
411
+ * const isValid = URL.canParse('/foo', 'https://example.org/'); // true
412
+ *
413
+ * const isNotValid = URL.canParse('/foo'); // false
414
+ * ```
415
+ * @since v18.17.0
416
+ * @param input The absolute or relative input URL to parse. If `input` is relative, then `base` is required. If `input` is absolute, the `base` is ignored. If `input` is not a string, it is
417
+ * `converted to a string` first.
418
+ * @param base The base URL to resolve against if the `input` is not absolute. If `base` is not a string, it is `converted to a string` first.
419
+ */
420
+ static canParse(input: string, base?: string): boolean;
407
421
  constructor(input: string, base?: string | URL);
408
422
  /**
409
423
  * Gets and sets the fragment portion of the URL.
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes