@alextheman/utility 5.12.0 → 5.13.1

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.
@@ -178,147 +178,42 @@ function normaliseIndents(first, ...args) {
178
178
  return reduceLines(interpolate(strings, ...[...args]).split("\n"), options);
179
179
  }
180
180
  //#endregion
181
- //#region src/root/functions/miscellaneous/sayHello.ts
181
+ //#region src/v6/CodeError.ts
182
182
  /**
183
- * Returns a string representing the lyrics to the package's theme song, Commit To You
184
- *
185
- * [Pls listen!](https://www.youtube.com/watch?v=mH-Sg-8EnxM)
186
- *
187
- * @returns The lyrics string in markdown format.
188
- */
189
- function sayHello() {
190
- return normaliseIndents`
191
- # Commit To You
192
-
193
- ### Verse 1
194
-
195
- I know you've been checking me out,
196
- Shall we take it to the next level now?
197
- 'Cause I really wanna be there all for you,
198
- All for you!
199
- Come on now, let's make a fresh start!
200
- Pin my number, then you can take me out!
201
- Can't you see I really do care about you,
202
- About you!
203
-
204
- ### Pre-chorus 1
205
- Although our calendars are imperfect, at best,
206
- I'd like to organise time with you! (with you!).
207
- Just tell me when and I'll make it clear,
208
- All clear for you,
209
- All clear for you!
210
- (One, two, three, go!)
211
-
212
- ### Chorus
213
- I wanna be of utility, I'll help you on the run!
214
- I'll be the one here in the back, while you go have some fun!
215
- Looking out for you tonight, I'll be the one you can rely on!
216
- Watch you go and watch me pass by,
217
- I'll be here!
218
- I'll commit to you!
219
-
220
- ### Verse 2
221
- Though sometimes it won't be easy,
222
- You'll be here to bring out the best in me,
223
- And I'll hold myself to high standards for you!
224
- All for you!
225
- We'll grow as a pair, you and me,
226
- We'll build up a healthy dependency,
227
- You can build with me and I'll develop with you!
228
- I'm with you!
229
-
230
- ### Pre-chorus 2
231
- I'll be with you when you're up or you're down,
232
- We'll deal with all our problems together (together!)
233
- Just tell me what you want, I'll make it clear,
234
- All clear for you,
235
- All clear for you!
236
- (One, three, one, go!)
237
-
238
- ### Chorus
239
- I wanna be of utility, I'll help you on the run!
240
- (help you on the run!)
241
- I'll be the one here in the back, while you go have some fun!
242
- (you go have some fun!)
243
- Looking out for you tonight, I'll be the one you can rely on!
244
- Watch you go and watch me pass by,
245
- I'll be here!
246
- I'll commit to you!
247
-
248
- ### Bridge
249
- Looking into our stack!
250
- I'll commit to you!
251
- We've got a lot to unpack!
252
- I'll commit to you!
253
- The environment that we're in!
254
- I'll commit to you!
255
- Delicate as a string!
256
- I'll commit to you!
257
-
258
- But I think you're my type!
259
- I'll commit to you!
260
- Oh, this feels all so right!
261
- I'll commit to you!
262
- Nothing stopping us now!
263
- I'll commit to you!
264
- Let's show them what we're about!
265
- Two, three, four, go!
266
-
267
- ### Final Chorus
268
- I wanna be of utility, I'll help you on the run!
269
- (help you on the run!)
270
- I'll be the one here in the back, while you go have some fun!
271
- (you go have some fun!)
272
- Looking out for you tonight, I'll be the one you can rely on!
273
- Watch you go and watch me pass by,
274
- I'll be here!
275
- I'll commit to you!
276
-
277
- I wanna be of utility, I'll help you on the run!
278
- (I'll commit to you!)
279
- I'll be the one here in the back, while you go have some fun!
280
- (I'll commit to you!)
281
- Looking out for you tonight, I'll be the one you can rely on!
282
- (I'll commit to you!)
283
- Watch you go and watch me pass by,
284
- (I'll commit to you!)
285
- I'll be here!
286
-
287
- ### Outro
288
- I'll commit to you!
289
- I'll commit to you!
290
- I'll commit to you!
291
- `;
292
- }
293
- //#endregion
294
- //#region src/root/types/DataError.ts
295
- /**
296
- * Represents errors you may get that may've been caused by a specific piece of data.
183
+ * Represents errors that can be described using a standardised error code, and a human-readable error message.
297
184
  *
298
185
  * @category Types
299
186
  *
300
- * @template DataType - The type of the data that caused the error.
187
+ * @template ErrorCode The type of the standardised error code.
301
188
  */
302
- var DataError = class DataError extends Error {
189
+ var CodeError = class CodeError extends Error {
303
190
  code;
304
- data;
305
191
  /**
306
- * @param data - The data that caused the error.
307
192
  * @param code - A standardised code (e.g. UNEXPECTED_DATA).
308
193
  * @param message - A human-readable error message (e.g. The data provided is invalid).
309
194
  * @param options - Extra options to pass to super Error constructor.
310
195
  */
311
- constructor(data, code = "INVALID_DATA", message = "The data provided is invalid", options) {
196
+ constructor(code, message = "Something went wrong.", options) {
312
197
  super(message, options);
313
198
  if (Error.captureStackTrace) Error.captureStackTrace(this, new.target);
314
199
  this.name = new.target.name;
315
200
  this.code = code;
316
- this.data = data;
317
201
  Object.defineProperty(this, "message", { enumerable: true });
318
202
  Object.setPrototypeOf(this, new.target.prototype);
319
203
  }
204
+ /**
205
+ * Checks whether the given input may have been caused by a CodeError.
206
+ *
207
+ * @param input - The input to check.
208
+ *
209
+ * @returns `true` if the input is a CodeError, and `false` otherwise. The type of the input will also be narrowed down to CodeError if `true`.
210
+ */
211
+ static check(input) {
212
+ if (input instanceof CodeError) return true;
213
+ return typeof input === "object" && input !== null && "message" in input && typeof input.message === "string" && "code" in input && typeof input.code === "string";
214
+ }
320
215
  static checkCaughtError(error, options) {
321
- if (DataError.check(error)) {
216
+ if (this.check(error)) {
322
217
  if (options?.expectedCode && error.code !== options.expectedCode) throw new Error(normaliseIndents`The error code on the thrown error does not match the expected error code.
323
218
 
324
219
  Expected: ${options.expectedCode}
@@ -329,6 +224,71 @@ var DataError = class DataError extends Error {
329
224
  throw error;
330
225
  }
331
226
  /**
227
+ * Gets the thrown `CodeError` from a given function if one was thrown, and re-throws any other errors, or throws a default `CodeError` if no error thrown.
228
+ *
229
+ * @param errorFunction - The function expected to throw the error.
230
+ * @param options - Extra options to apply.
231
+ *
232
+ * @throws {Error} Any other errors thrown by the `errorFunction` that are not a `CodeError`.
233
+ * @throws {Error} If no `CodeError` was thrown by the `errorFunction`
234
+ *
235
+ * @returns The `CodeError` that was thrown by the `errorFunction`
236
+ */
237
+ static expectError(errorFunction, options) {
238
+ try {
239
+ errorFunction();
240
+ } catch (error) {
241
+ return this.checkCaughtError(error, options);
242
+ }
243
+ throw new Error(`Expected a ${this.name} to be thrown but none was thrown`);
244
+ }
245
+ /**
246
+ * Gets the thrown `CodeError` from a given asynchronous function if one was thrown, and re-throws any other errors, or throws a default `CodeError` if no error thrown.
247
+ *
248
+ * @param errorFunction - The function expected to throw the error.
249
+ * @param options - Extra options to apply.
250
+ *
251
+ * @throws {Error} Any other errors thrown by the `errorFunction` that are not a `CodeError`.
252
+ * @throws {Error} If no `CodeError` was thrown by the `errorFunction`
253
+ *
254
+ * @returns The `CodeError` that was thrown by the `errorFunction`
255
+ */
256
+ static async expectErrorAsync(errorFunction, options) {
257
+ try {
258
+ await errorFunction();
259
+ } catch (error) {
260
+ return this.checkCaughtError(error, options);
261
+ }
262
+ throw new Error(`Expected a ${this.name} to be thrown but none was thrown`);
263
+ }
264
+ };
265
+ //#endregion
266
+ //#region src/v6/DataError.ts
267
+ /**
268
+ * Represents errors you may get that may've been caused by a specific piece of data.
269
+ *
270
+ * @category Types
271
+ *
272
+ * @template DataType - The type of the data that caused the error.
273
+ */
274
+ var DataError = class DataError extends CodeError {
275
+ data;
276
+ /**
277
+ * @param data - The data that caused the error.
278
+ * @param code - A standardised code (e.g. UNEXPECTED_DATA).
279
+ * @param message - A human-readable error message (e.g. The data provided is invalid).
280
+ * @param options - Extra options to pass to super Error constructor.
281
+ */
282
+ constructor(data, code = "INVALID_DATA", message = "The data provided is invalid", options) {
283
+ super(code, message, options);
284
+ if (Error.captureStackTrace) Error.captureStackTrace(this, new.target);
285
+ this.name = new.target.name;
286
+ this.code = code;
287
+ this.data = data;
288
+ Object.defineProperty(this, "message", { enumerable: true });
289
+ Object.setPrototypeOf(this, new.target.prototype);
290
+ }
291
+ /**
332
292
  * Checks whether the given input may have been caused by a DataError.
333
293
  *
334
294
  * @param input - The input to check.
@@ -337,8 +297,7 @@ var DataError = class DataError extends Error {
337
297
  */
338
298
  static check(input) {
339
299
  if (input instanceof DataError) return true;
340
- const data = input;
341
- return typeof data === "object" && data !== null && typeof data.message === "string" && typeof data.code === "string" && "data" in data;
300
+ return typeof input === "object" && input !== null && "message" in input && typeof input.message === "string" && "code" in input && typeof input.code === "string" && "data" in input;
342
301
  }
343
302
  /**
344
303
  * Gets the thrown `DataError` from a given function if one was thrown, and re-throws any other errors, or throws a default `DataError` if no error thrown.
@@ -352,12 +311,7 @@ var DataError = class DataError extends Error {
352
311
  * @returns The `DataError` that was thrown by the `errorFunction`
353
312
  */
354
313
  static expectError(errorFunction, options) {
355
- try {
356
- errorFunction();
357
- } catch (error) {
358
- return DataError.checkCaughtError(error, options);
359
- }
360
- throw new Error("Expected a DataError to be thrown but none was thrown");
314
+ return super.expectError(errorFunction, options);
361
315
  }
362
316
  /**
363
317
  * Gets the thrown `DataError` from a given asynchronous function if one was thrown, and re-throws any other errors, or throws a default `DataError` if no error thrown.
@@ -371,12 +325,7 @@ var DataError = class DataError extends Error {
371
325
  * @returns The `DataError` that was thrown by the `errorFunction`
372
326
  */
373
327
  static async expectErrorAsync(errorFunction, options) {
374
- try {
375
- await errorFunction();
376
- } catch (error) {
377
- return DataError.checkCaughtError(error, options);
378
- }
379
- throw new Error("Expected a DataError to be thrown but none was thrown");
328
+ return await super.expectErrorAsync(errorFunction, options);
380
329
  }
381
330
  };
382
331
  //#endregion
@@ -411,6 +360,116 @@ function parseFilePath(filePath) {
411
360
  }
412
361
  //#endregion
413
362
  //#region src/node/functions/sayHello.ts
414
- var sayHello_default = sayHello;
363
+ /**
364
+ * Returns a string representing the lyrics to the package's theme song, Commit To You
365
+ *
366
+ * [Pls listen!](https://www.youtube.com/watch?v=mH-Sg-8EnxM)
367
+ *
368
+ * @returns The lyrics string in markdown format.
369
+ */
370
+ function sayHello() {
371
+ return `
372
+ # Commit To You
373
+
374
+ ### Verse 1
375
+
376
+ I know you've been checking me out,
377
+ Shall we take it to the next level now?
378
+ 'Cause I really wanna be there all for you,
379
+ All for you!
380
+ Come on now, let's make a fresh start!
381
+ Pin my number, then you can take me out!
382
+ Can't you see I really do care about you,
383
+ About you!
384
+
385
+ ### Pre-chorus 1
386
+ Although our calendars are imperfect, at best,
387
+ I'd like to organise time with you! (with you!).
388
+ Just tell me when and I'll make it clear,
389
+ All clear for you,
390
+ All clear for you!
391
+ (One, two, three, go!)
392
+
393
+ ### Chorus
394
+ I wanna be of utility, I'll help you on the run!
395
+ I'll be the one here in the back, while you go have some fun!
396
+ Looking out for you tonight, I'll be the one you can rely on!
397
+ Watch you go and watch me pass by,
398
+ I'll be here!
399
+ I'll commit to you!
400
+
401
+ ### Verse 2
402
+ Though sometimes it won't be easy,
403
+ You'll be here to bring out the best in me,
404
+ And I'll hold myself to high standards for you!
405
+ All for you!
406
+ We'll grow as a pair, you and me,
407
+ We'll build up a healthy dependency,
408
+ You can build with me and I'll develop with you!
409
+ I'm with you!
410
+
411
+ ### Pre-chorus 2
412
+ I'll be with you when you're up or you're down,
413
+ We'll deal with all our problems together (together!)
414
+ Just tell me what you want, I'll make it clear,
415
+ All clear for you,
416
+ All clear for you!
417
+ (One, three, one, go!)
418
+
419
+ ### Chorus
420
+ I wanna be of utility, I'll help you on the run!
421
+ (help you on the run!)
422
+ I'll be the one here in the back, while you go have some fun!
423
+ (you go have some fun!)
424
+ Looking out for you tonight, I'll be the one you can rely on!
425
+ Watch you go and watch me pass by,
426
+ I'll be here!
427
+ I'll commit to you!
428
+
429
+ ### Bridge
430
+ Looking into our stack!
431
+ I'll commit to you!
432
+ We've got a lot to unpack!
433
+ I'll commit to you!
434
+ The environment that we're in!
435
+ I'll commit to you!
436
+ Delicate as a string!
437
+ I'll commit to you!
438
+
439
+ But I think you're my type!
440
+ I'll commit to you!
441
+ Oh, this feels all so right!
442
+ I'll commit to you!
443
+ Nothing stopping us now!
444
+ I'll commit to you!
445
+ Let's show them what we're about!
446
+ Two, three, four, go!
447
+
448
+ ### Final Chorus
449
+ I wanna be of utility, I'll help you on the run!
450
+ (help you on the run!)
451
+ I'll be the one here in the back, while you go have some fun!
452
+ (you go have some fun!)
453
+ Looking out for you tonight, I'll be the one you can rely on!
454
+ Watch you go and watch me pass by,
455
+ I'll be here!
456
+ I'll commit to you!
457
+
458
+ I wanna be of utility, I'll help you on the run!
459
+ (I'll commit to you!)
460
+ I'll be the one here in the back, while you go have some fun!
461
+ (I'll commit to you!)
462
+ Looking out for you tonight, I'll be the one you can rely on!
463
+ (I'll commit to you!)
464
+ Watch you go and watch me pass by,
465
+ (I'll commit to you!)
466
+ I'll be here!
467
+
468
+ ### Outro
469
+ I'll commit to you!
470
+ I'll commit to you!
471
+ I'll commit to you!
472
+ `;
473
+ }
415
474
  //#endregion
416
- export { normaliseImportPath, normalizeImportPath, parseFilePath, sayHello_default as sayHello };
475
+ export { normaliseImportPath, normalizeImportPath, parseFilePath, sayHello };
package/dist/v6/index.cjs CHANGED
@@ -138,119 +138,6 @@ function normaliseIndents(first, ...args) {
138
138
  return reduceLines(interpolate(strings, ...[...args]).split("\n"), options);
139
139
  }
140
140
  //#endregion
141
- //#region src/root/functions/miscellaneous/sayHello.ts
142
- /**
143
- * Returns a string representing the lyrics to the package's theme song, Commit To You
144
- *
145
- * [Pls listen!](https://www.youtube.com/watch?v=mH-Sg-8EnxM)
146
- *
147
- * @returns The lyrics string in markdown format.
148
- */
149
- function sayHello() {
150
- return normaliseIndents`
151
- # Commit To You
152
-
153
- ### Verse 1
154
-
155
- I know you've been checking me out,
156
- Shall we take it to the next level now?
157
- 'Cause I really wanna be there all for you,
158
- All for you!
159
- Come on now, let's make a fresh start!
160
- Pin my number, then you can take me out!
161
- Can't you see I really do care about you,
162
- About you!
163
-
164
- ### Pre-chorus 1
165
- Although our calendars are imperfect, at best,
166
- I'd like to organise time with you! (with you!).
167
- Just tell me when and I'll make it clear,
168
- All clear for you,
169
- All clear for you!
170
- (One, two, three, go!)
171
-
172
- ### Chorus
173
- I wanna be of utility, I'll help you on the run!
174
- I'll be the one here in the back, while you go have some fun!
175
- Looking out for you tonight, I'll be the one you can rely on!
176
- Watch you go and watch me pass by,
177
- I'll be here!
178
- I'll commit to you!
179
-
180
- ### Verse 2
181
- Though sometimes it won't be easy,
182
- You'll be here to bring out the best in me,
183
- And I'll hold myself to high standards for you!
184
- All for you!
185
- We'll grow as a pair, you and me,
186
- We'll build up a healthy dependency,
187
- You can build with me and I'll develop with you!
188
- I'm with you!
189
-
190
- ### Pre-chorus 2
191
- I'll be with you when you're up or you're down,
192
- We'll deal with all our problems together (together!)
193
- Just tell me what you want, I'll make it clear,
194
- All clear for you,
195
- All clear for you!
196
- (One, three, one, go!)
197
-
198
- ### Chorus
199
- I wanna be of utility, I'll help you on the run!
200
- (help you on the run!)
201
- I'll be the one here in the back, while you go have some fun!
202
- (you go have some fun!)
203
- Looking out for you tonight, I'll be the one you can rely on!
204
- Watch you go and watch me pass by,
205
- I'll be here!
206
- I'll commit to you!
207
-
208
- ### Bridge
209
- Looking into our stack!
210
- I'll commit to you!
211
- We've got a lot to unpack!
212
- I'll commit to you!
213
- The environment that we're in!
214
- I'll commit to you!
215
- Delicate as a string!
216
- I'll commit to you!
217
-
218
- But I think you're my type!
219
- I'll commit to you!
220
- Oh, this feels all so right!
221
- I'll commit to you!
222
- Nothing stopping us now!
223
- I'll commit to you!
224
- Let's show them what we're about!
225
- Two, three, four, go!
226
-
227
- ### Final Chorus
228
- I wanna be of utility, I'll help you on the run!
229
- (help you on the run!)
230
- I'll be the one here in the back, while you go have some fun!
231
- (you go have some fun!)
232
- Looking out for you tonight, I'll be the one you can rely on!
233
- Watch you go and watch me pass by,
234
- I'll be here!
235
- I'll commit to you!
236
-
237
- I wanna be of utility, I'll help you on the run!
238
- (I'll commit to you!)
239
- I'll be the one here in the back, while you go have some fun!
240
- (I'll commit to you!)
241
- Looking out for you tonight, I'll be the one you can rely on!
242
- (I'll commit to you!)
243
- Watch you go and watch me pass by,
244
- (I'll commit to you!)
245
- I'll be here!
246
-
247
- ### Outro
248
- I'll commit to you!
249
- I'll commit to you!
250
- I'll commit to you!
251
- `;
252
- }
253
- //#endregion
254
141
  //#region src/v6/CodeError.ts
255
142
  /**
256
143
  * Represents errors that can be described using a standardised error code, and a human-readable error message.
@@ -371,8 +258,7 @@ var DataError = class DataError extends CodeError {
371
258
  */
372
259
  static check(input) {
373
260
  if (input instanceof DataError) return true;
374
- const data = input;
375
- return typeof data === "object" && data !== null && typeof data.message === "string" && typeof data.code === "string" && "data" in data;
261
+ return typeof input === "object" && input !== null && "message" in input && typeof input.message === "string" && "code" in input && typeof input.code === "string" && "data" in input;
376
262
  }
377
263
  /**
378
264
  * Gets the thrown `DataError` from a given function if one was thrown, and re-throws any other errors, or throws a default `DataError` if no error thrown.
@@ -404,6 +290,119 @@ var DataError = class DataError extends CodeError {
404
290
  }
405
291
  };
406
292
  //#endregion
293
+ //#region src/v6/sayHello.ts
294
+ /**
295
+ * Returns a string representing the lyrics to the package's theme song, Commit To You
296
+ *
297
+ * [Pls listen!](https://www.youtube.com/watch?v=mH-Sg-8EnxM)
298
+ *
299
+ * @returns The lyrics string in markdown format.
300
+ */
301
+ function sayHello() {
302
+ return `
303
+ # Commit To You
304
+
305
+ ### Verse 1
306
+
307
+ I know you've been checking me out,
308
+ Shall we take it to the next level now?
309
+ 'Cause I really wanna be there all for you,
310
+ All for you!
311
+ Come on now, let's make a fresh start!
312
+ Pin my number, then you can take me out!
313
+ Can't you see I really do care about you,
314
+ About you!
315
+
316
+ ### Pre-chorus 1
317
+ Although our calendars are imperfect, at best,
318
+ I'd like to organise time with you! (with you!).
319
+ Just tell me when and I'll make it clear,
320
+ All clear for you,
321
+ All clear for you!
322
+ (One, two, three, go!)
323
+
324
+ ### Chorus
325
+ I wanna be of utility, I'll help you on the run!
326
+ I'll be the one here in the back, while you go have some fun!
327
+ Looking out for you tonight, I'll be the one you can rely on!
328
+ Watch you go and watch me pass by,
329
+ I'll be here!
330
+ I'll commit to you!
331
+
332
+ ### Verse 2
333
+ Though sometimes it won't be easy,
334
+ You'll be here to bring out the best in me,
335
+ And I'll hold myself to high standards for you!
336
+ All for you!
337
+ We'll grow as a pair, you and me,
338
+ We'll build up a healthy dependency,
339
+ You can build with me and I'll develop with you!
340
+ I'm with you!
341
+
342
+ ### Pre-chorus 2
343
+ I'll be with you when you're up or you're down,
344
+ We'll deal with all our problems together (together!)
345
+ Just tell me what you want, I'll make it clear,
346
+ All clear for you,
347
+ All clear for you!
348
+ (One, three, one, go!)
349
+
350
+ ### Chorus
351
+ I wanna be of utility, I'll help you on the run!
352
+ (help you on the run!)
353
+ I'll be the one here in the back, while you go have some fun!
354
+ (you go have some fun!)
355
+ Looking out for you tonight, I'll be the one you can rely on!
356
+ Watch you go and watch me pass by,
357
+ I'll be here!
358
+ I'll commit to you!
359
+
360
+ ### Bridge
361
+ Looking into our stack!
362
+ I'll commit to you!
363
+ We've got a lot to unpack!
364
+ I'll commit to you!
365
+ The environment that we're in!
366
+ I'll commit to you!
367
+ Delicate as a string!
368
+ I'll commit to you!
369
+
370
+ But I think you're my type!
371
+ I'll commit to you!
372
+ Oh, this feels all so right!
373
+ I'll commit to you!
374
+ Nothing stopping us now!
375
+ I'll commit to you!
376
+ Let's show them what we're about!
377
+ Two, three, four, go!
378
+
379
+ ### Final Chorus
380
+ I wanna be of utility, I'll help you on the run!
381
+ (help you on the run!)
382
+ I'll be the one here in the back, while you go have some fun!
383
+ (you go have some fun!)
384
+ Looking out for you tonight, I'll be the one you can rely on!
385
+ Watch you go and watch me pass by,
386
+ I'll be here!
387
+ I'll commit to you!
388
+
389
+ I wanna be of utility, I'll help you on the run!
390
+ (I'll commit to you!)
391
+ I'll be the one here in the back, while you go have some fun!
392
+ (I'll commit to you!)
393
+ Looking out for you tonight, I'll be the one you can rely on!
394
+ (I'll commit to you!)
395
+ Watch you go and watch me pass by,
396
+ (I'll commit to you!)
397
+ I'll be here!
398
+
399
+ ### Outro
400
+ I'll commit to you!
401
+ I'll commit to you!
402
+ I'll commit to you!
403
+ `;
404
+ }
405
+ //#endregion
407
406
  exports.CodeError = CodeError;
408
407
  exports.DataError = DataError;
409
408
  exports.DataErrorCode = DataErrorCode;
@@ -1,13 +1,3 @@
1
- //#region src/root/functions/miscellaneous/sayHello.d.ts
2
- /**
3
- * Returns a string representing the lyrics to the package's theme song, Commit To You
4
- *
5
- * [Pls listen!](https://www.youtube.com/watch?v=mH-Sg-8EnxM)
6
- *
7
- * @returns The lyrics string in markdown format.
8
- */
9
- declare function sayHello(): string;
10
- //#endregion
11
1
  //#region src/v6/CodeError.d.ts
12
2
  interface ExpectErrorOptions$1<ErrorCode extends string = string> {
13
3
  expectedCode?: ErrorCode;
@@ -91,7 +81,7 @@ type DataErrorCode = CreateEnumType<typeof DataErrorCode>;
91
81
  *
92
82
  * @template DataType - The type of the data that caused the error.
93
83
  */
94
- declare class DataError<DataType extends Record<PropertyKey, unknown> = Record<PropertyKey, unknown>, ErrorCode extends string = DataErrorCode> extends CodeError<ErrorCode | DataErrorCode> {
84
+ declare class DataError<DataType extends object = Record<PropertyKey, unknown>, ErrorCode extends string = DataErrorCode> extends CodeError<ErrorCode | DataErrorCode> {
95
85
  data: DataType;
96
86
  /**
97
87
  * @param data - The data that caused the error.
@@ -107,7 +97,7 @@ declare class DataError<DataType extends Record<PropertyKey, unknown> = Record<P
107
97
  *
108
98
  * @returns `true` if the input is a DataError, and `false` otherwise. The type of the input will also be narrowed down to DataError if `true`.
109
99
  */
110
- static check(input: unknown): input is DataError;
100
+ static check<DataType extends object = Record<PropertyKey, unknown>, ErrorCode extends string = DataErrorCode>(input: unknown): input is DataError<DataType, ErrorCode>;
111
101
  /**
112
102
  * Gets the thrown `DataError` from a given function if one was thrown, and re-throws any other errors, or throws a default `DataError` if no error thrown.
113
103
  *
@@ -134,4 +124,14 @@ declare class DataError<DataType extends Record<PropertyKey, unknown> = Record<P
134
124
  static expectErrorAsync<DataType extends Record<PropertyKey, unknown>, ErrorCode extends string = DefaultDataErrorCode>(errorFunction: () => Promise<unknown>, options?: ExpectErrorOptions<ErrorCode>): Promise<DataError<DataType, ErrorCode>>;
135
125
  }
136
126
  //#endregion
127
+ //#region src/v6/sayHello.d.ts
128
+ /**
129
+ * Returns a string representing the lyrics to the package's theme song, Commit To You
130
+ *
131
+ * [Pls listen!](https://www.youtube.com/watch?v=mH-Sg-8EnxM)
132
+ *
133
+ * @returns The lyrics string in markdown format.
134
+ */
135
+ declare function sayHello(): string;
136
+ //#endregion
137
137
  export { CodeError, DataError, DataErrorCode, type ExpectErrorOptions, type IsTypeArgumentString, sayHello };