@alextheman/utility 5.16.1 → 5.17.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.
- package/dist/index.cjs +34 -0
- package/dist/index.d.cts +31 -3
- package/dist/index.d.ts +31 -3
- package/dist/index.js +33 -1
- package/dist/internal/index.d.cts +2 -2
- package/dist/internal/index.d.ts +2 -2
- package/dist/v6/index.d.cts +4 -4
- package/dist/v6/index.d.ts +4 -4
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1871,6 +1871,38 @@ function assertNotNull(input) {
|
|
|
1871
1871
|
if (input === null) throw new DataError$1({ input }, "NULL_INPUT", "Expected the input not to be null");
|
|
1872
1872
|
}
|
|
1873
1873
|
//#endregion
|
|
1874
|
+
//#region src/root/errors/assertNotNullable.ts
|
|
1875
|
+
/**
|
|
1876
|
+
* Asserts that a given input is not `undefined` or `null`, and throws a DataError if it does.
|
|
1877
|
+
*
|
|
1878
|
+
* If no error is thrown from this, the input type gets narrowed down to not include `undefined` or `null`.
|
|
1879
|
+
*
|
|
1880
|
+
* @template InputType The type of the input.
|
|
1881
|
+
*
|
|
1882
|
+
* @param input - The input to assert against.
|
|
1883
|
+
*
|
|
1884
|
+
* @throws {DataError} If the input is `undefined` or `null`.
|
|
1885
|
+
*/
|
|
1886
|
+
function assertNotNullable(input) {
|
|
1887
|
+
if (input === null || input === void 0) throw new DataError$1({ input }, "NULLABLE_INPUT", "Expected the input not to be undefined or null");
|
|
1888
|
+
}
|
|
1889
|
+
//#endregion
|
|
1890
|
+
//#region src/root/errors/assertNotUndefined.ts
|
|
1891
|
+
/**
|
|
1892
|
+
* Asserts that a given input is not `undefined`, and throws a DataError if it does.
|
|
1893
|
+
*
|
|
1894
|
+
* If no error is thrown from this, the input type gets narrowed down to not include `undefined`.
|
|
1895
|
+
*
|
|
1896
|
+
* @template InputType The type of the input.
|
|
1897
|
+
*
|
|
1898
|
+
* @param input - The input to assert against.
|
|
1899
|
+
*
|
|
1900
|
+
* @throws {DataError} If the input is `undefined`.
|
|
1901
|
+
*/
|
|
1902
|
+
function assertNotUndefined(input) {
|
|
1903
|
+
if (input === void 0) throw new DataError$1({ input }, "UNDEFINED_INPUT", "Expected the input not to be undefined");
|
|
1904
|
+
}
|
|
1905
|
+
//#endregion
|
|
1874
1906
|
exports.APIError = APIError;
|
|
1875
1907
|
exports.DataError = DataError;
|
|
1876
1908
|
exports.Env = Env;
|
|
@@ -1886,6 +1918,8 @@ exports.VersionType = VersionType;
|
|
|
1886
1918
|
exports.addDaysToDate = addDaysToDate;
|
|
1887
1919
|
exports.appendSemicolon = appendSemicolon;
|
|
1888
1920
|
exports.assertNotNull = assertNotNull;
|
|
1921
|
+
exports.assertNotNullable = assertNotNullable;
|
|
1922
|
+
exports.assertNotUndefined = assertNotUndefined;
|
|
1889
1923
|
exports.az = az;
|
|
1890
1924
|
exports.calculateMonthlyDifference = calculateMonthlyDifference;
|
|
1891
1925
|
exports.camelToKebab = camelToKebab;
|
package/dist/index.d.cts
CHANGED
|
@@ -1137,6 +1137,34 @@ type OptionalOnCondition<Condition extends boolean, ResolvedTypeIfTrue> = Condit
|
|
|
1137
1137
|
*/
|
|
1138
1138
|
declare function assertNotNull<InputType>(input: InputType): asserts input is NonNull<InputType>;
|
|
1139
1139
|
//#endregion
|
|
1140
|
+
//#region src/root/errors/assertNotNullable.d.ts
|
|
1141
|
+
/**
|
|
1142
|
+
* Asserts that a given input is not `undefined` or `null`, and throws a DataError if it does.
|
|
1143
|
+
*
|
|
1144
|
+
* If no error is thrown from this, the input type gets narrowed down to not include `undefined` or `null`.
|
|
1145
|
+
*
|
|
1146
|
+
* @template InputType The type of the input.
|
|
1147
|
+
*
|
|
1148
|
+
* @param input - The input to assert against.
|
|
1149
|
+
*
|
|
1150
|
+
* @throws {DataError} If the input is `undefined` or `null`.
|
|
1151
|
+
*/
|
|
1152
|
+
declare function assertNotNullable<InputType>(input: InputType): asserts input is NonNullable<InputType>;
|
|
1153
|
+
//#endregion
|
|
1154
|
+
//#region src/root/errors/assertNotUndefined.d.ts
|
|
1155
|
+
/**
|
|
1156
|
+
* Asserts that a given input is not `undefined`, and throws a DataError if it does.
|
|
1157
|
+
*
|
|
1158
|
+
* If no error is thrown from this, the input type gets narrowed down to not include `undefined`.
|
|
1159
|
+
*
|
|
1160
|
+
* @template InputType The type of the input.
|
|
1161
|
+
*
|
|
1162
|
+
* @param input - The input to assert against.
|
|
1163
|
+
*
|
|
1164
|
+
* @throws {DataError} If the input is `undefined`.
|
|
1165
|
+
*/
|
|
1166
|
+
declare function assertNotUndefined<InputType>(input: InputType): asserts input is NonUndefined<InputType>;
|
|
1167
|
+
//#endregion
|
|
1140
1168
|
//#region src/v6/CodeError.d.ts
|
|
1141
1169
|
interface ExpectErrorOptions<ErrorCode extends string = string> {
|
|
1142
1170
|
expectedCode?: ErrorCode;
|
|
@@ -1260,7 +1288,7 @@ declare class DataError$1<DataType extends object = Record<PropertyKey, unknown>
|
|
|
1260
1288
|
*
|
|
1261
1289
|
* @returns The `DataError` that was thrown by the `errorFunction`
|
|
1262
1290
|
*/
|
|
1263
|
-
static expectError<DataType extends Record<PropertyKey, unknown>, ErrorCode extends string = string>(errorFunction: () => unknown, options?: ExpectErrorOptions<ErrorCode>): DataError$1<DataType, ErrorCode>;
|
|
1291
|
+
static expectError<DataType extends object = Record<PropertyKey, unknown>, ErrorCode extends string = string>(errorFunction: () => unknown, options?: ExpectErrorOptions<ErrorCode>): DataError$1<DataType, ErrorCode>;
|
|
1264
1292
|
/**
|
|
1265
1293
|
* 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.
|
|
1266
1294
|
*
|
|
@@ -1272,7 +1300,7 @@ declare class DataError$1<DataType extends object = Record<PropertyKey, unknown>
|
|
|
1272
1300
|
*
|
|
1273
1301
|
* @returns The `DataError` that was thrown by the `errorFunction`
|
|
1274
1302
|
*/
|
|
1275
|
-
static expectErrorAsync<DataType extends Record<PropertyKey, unknown>, ErrorCode extends string = string>(errorFunction: () => Promise<unknown>, options?: ExpectErrorOptions<ErrorCode>): Promise<DataError$1<DataType, ErrorCode>>;
|
|
1303
|
+
static expectErrorAsync<DataType extends object = Record<PropertyKey, unknown>, ErrorCode extends string = string>(errorFunction: () => Promise<unknown>, options?: ExpectErrorOptions<ErrorCode>): Promise<DataError$1<DataType, ErrorCode>>;
|
|
1276
1304
|
/**
|
|
1277
1305
|
* Converts the `DataError` instance to a serialised JSON payload.
|
|
1278
1306
|
*
|
|
@@ -1340,4 +1368,4 @@ declare const az: {
|
|
|
1340
1368
|
};
|
|
1341
1369
|
};
|
|
1342
1370
|
//#endregion
|
|
1343
|
-
export { APIError, type ArrayElement, type CallReturnType, CamelToKebabOptions, type CreateEnumType, type CreateFormDataOptions, type CreateFormDataOptionsNullableResolution, type CreateFormDataOptionsUndefinedOrNullResolution, DataError, type DisallowUndefined, Env, FILE_PATH_PATTERN, FILE_PATH_REGEX, type FormDataArrayResolutionStrategy, type FormDataNullableResolutionStrategy, type HTTPErrorCode, type IgnoreCase, type IsTypeArgumentString, KebabToCamelOptions, type NonNull, type NonUndefined, NormaliseIndentsFunction, NormaliseIndentsOptions, NormalizeIndentsFunction, NormalizeIndentsOptions, type NullableOnCondition, ONE_DAY_IN_MILLISECONDS, type OptionalOnCondition, ParallelTuple, RecordKey, RemoveUndefined, type StringListToArrayOptions, ToTitleCaseOptions, UUID_PATTERN, UUID_REGEX, VERSION_NUMBER_PATTERN, VERSION_NUMBER_REGEX, VersionNumber, type FormatOptionsBase as VersionNumberToStringOptions, VersionType, addDaysToDate, appendSemicolon, assertNotNull, az, calculateMonthlyDifference, camelToKebab, convertFileToBase64, createFormData, createTemplateStringsArray, deepCopy, deepFreeze, escapeRegexPattern, fillArray, formatDateAndTime, getRandomNumber, getRecordKeys, getStringsAndInterpolations, httpErrorCodeLookup, interpolate, interpolateObjects, isAnniversary, isLeapYear, isMonthlyMultiple, isOrdered, isSameDate, isTemplateStringsArray, kebabToCamel, normaliseIndents, normalizeIndents, omitProperties, paralleliseArrays, parseBoolean, parseEnv, parseFormData, parseIntStrict, parseUUID, parseVersionType, parseZodSchema, parseZodSchemaAsync, randomiseArray, range, removeDuplicates, removeUndefinedFromObject, sayHello, stringListToArray, stringifyDotenv, toTitleCase, truncate, wait, zodVersionNumber };
|
|
1371
|
+
export { APIError, type ArrayElement, type CallReturnType, CamelToKebabOptions, type CreateEnumType, type CreateFormDataOptions, type CreateFormDataOptionsNullableResolution, type CreateFormDataOptionsUndefinedOrNullResolution, DataError, type DisallowUndefined, Env, FILE_PATH_PATTERN, FILE_PATH_REGEX, type FormDataArrayResolutionStrategy, type FormDataNullableResolutionStrategy, type HTTPErrorCode, type IgnoreCase, type IsTypeArgumentString, KebabToCamelOptions, type NonNull, type NonUndefined, NormaliseIndentsFunction, NormaliseIndentsOptions, NormalizeIndentsFunction, NormalizeIndentsOptions, type NullableOnCondition, ONE_DAY_IN_MILLISECONDS, type OptionalOnCondition, ParallelTuple, RecordKey, RemoveUndefined, type StringListToArrayOptions, ToTitleCaseOptions, UUID_PATTERN, UUID_REGEX, VERSION_NUMBER_PATTERN, VERSION_NUMBER_REGEX, VersionNumber, type FormatOptionsBase as VersionNumberToStringOptions, VersionType, addDaysToDate, appendSemicolon, assertNotNull, assertNotNullable, assertNotUndefined, az, calculateMonthlyDifference, camelToKebab, convertFileToBase64, createFormData, createTemplateStringsArray, deepCopy, deepFreeze, escapeRegexPattern, fillArray, formatDateAndTime, getRandomNumber, getRecordKeys, getStringsAndInterpolations, httpErrorCodeLookup, interpolate, interpolateObjects, isAnniversary, isLeapYear, isMonthlyMultiple, isOrdered, isSameDate, isTemplateStringsArray, kebabToCamel, normaliseIndents, normalizeIndents, omitProperties, paralleliseArrays, parseBoolean, parseEnv, parseFormData, parseIntStrict, parseUUID, parseVersionType, parseZodSchema, parseZodSchemaAsync, randomiseArray, range, removeDuplicates, removeUndefinedFromObject, sayHello, stringListToArray, stringifyDotenv, toTitleCase, truncate, wait, zodVersionNumber };
|
package/dist/index.d.ts
CHANGED
|
@@ -1137,6 +1137,34 @@ type OptionalOnCondition<Condition extends boolean, ResolvedTypeIfTrue> = Condit
|
|
|
1137
1137
|
*/
|
|
1138
1138
|
declare function assertNotNull<InputType>(input: InputType): asserts input is NonNull<InputType>;
|
|
1139
1139
|
//#endregion
|
|
1140
|
+
//#region src/root/errors/assertNotNullable.d.ts
|
|
1141
|
+
/**
|
|
1142
|
+
* Asserts that a given input is not `undefined` or `null`, and throws a DataError if it does.
|
|
1143
|
+
*
|
|
1144
|
+
* If no error is thrown from this, the input type gets narrowed down to not include `undefined` or `null`.
|
|
1145
|
+
*
|
|
1146
|
+
* @template InputType The type of the input.
|
|
1147
|
+
*
|
|
1148
|
+
* @param input - The input to assert against.
|
|
1149
|
+
*
|
|
1150
|
+
* @throws {DataError} If the input is `undefined` or `null`.
|
|
1151
|
+
*/
|
|
1152
|
+
declare function assertNotNullable<InputType>(input: InputType): asserts input is NonNullable<InputType>;
|
|
1153
|
+
//#endregion
|
|
1154
|
+
//#region src/root/errors/assertNotUndefined.d.ts
|
|
1155
|
+
/**
|
|
1156
|
+
* Asserts that a given input is not `undefined`, and throws a DataError if it does.
|
|
1157
|
+
*
|
|
1158
|
+
* If no error is thrown from this, the input type gets narrowed down to not include `undefined`.
|
|
1159
|
+
*
|
|
1160
|
+
* @template InputType The type of the input.
|
|
1161
|
+
*
|
|
1162
|
+
* @param input - The input to assert against.
|
|
1163
|
+
*
|
|
1164
|
+
* @throws {DataError} If the input is `undefined`.
|
|
1165
|
+
*/
|
|
1166
|
+
declare function assertNotUndefined<InputType>(input: InputType): asserts input is NonUndefined<InputType>;
|
|
1167
|
+
//#endregion
|
|
1140
1168
|
//#region src/v6/CodeError.d.ts
|
|
1141
1169
|
interface ExpectErrorOptions<ErrorCode extends string = string> {
|
|
1142
1170
|
expectedCode?: ErrorCode;
|
|
@@ -1260,7 +1288,7 @@ declare class DataError$1<DataType extends object = Record<PropertyKey, unknown>
|
|
|
1260
1288
|
*
|
|
1261
1289
|
* @returns The `DataError` that was thrown by the `errorFunction`
|
|
1262
1290
|
*/
|
|
1263
|
-
static expectError<DataType extends Record<PropertyKey, unknown>, ErrorCode extends string = string>(errorFunction: () => unknown, options?: ExpectErrorOptions<ErrorCode>): DataError$1<DataType, ErrorCode>;
|
|
1291
|
+
static expectError<DataType extends object = Record<PropertyKey, unknown>, ErrorCode extends string = string>(errorFunction: () => unknown, options?: ExpectErrorOptions<ErrorCode>): DataError$1<DataType, ErrorCode>;
|
|
1264
1292
|
/**
|
|
1265
1293
|
* 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.
|
|
1266
1294
|
*
|
|
@@ -1272,7 +1300,7 @@ declare class DataError$1<DataType extends object = Record<PropertyKey, unknown>
|
|
|
1272
1300
|
*
|
|
1273
1301
|
* @returns The `DataError` that was thrown by the `errorFunction`
|
|
1274
1302
|
*/
|
|
1275
|
-
static expectErrorAsync<DataType extends Record<PropertyKey, unknown>, ErrorCode extends string = string>(errorFunction: () => Promise<unknown>, options?: ExpectErrorOptions<ErrorCode>): Promise<DataError$1<DataType, ErrorCode>>;
|
|
1303
|
+
static expectErrorAsync<DataType extends object = Record<PropertyKey, unknown>, ErrorCode extends string = string>(errorFunction: () => Promise<unknown>, options?: ExpectErrorOptions<ErrorCode>): Promise<DataError$1<DataType, ErrorCode>>;
|
|
1276
1304
|
/**
|
|
1277
1305
|
* Converts the `DataError` instance to a serialised JSON payload.
|
|
1278
1306
|
*
|
|
@@ -1340,4 +1368,4 @@ declare const az: {
|
|
|
1340
1368
|
};
|
|
1341
1369
|
};
|
|
1342
1370
|
//#endregion
|
|
1343
|
-
export { APIError, type ArrayElement, type CallReturnType, CamelToKebabOptions, type CreateEnumType, type CreateFormDataOptions, type CreateFormDataOptionsNullableResolution, type CreateFormDataOptionsUndefinedOrNullResolution, DataError, type DisallowUndefined, Env, FILE_PATH_PATTERN, FILE_PATH_REGEX, type FormDataArrayResolutionStrategy, type FormDataNullableResolutionStrategy, type HTTPErrorCode, type IgnoreCase, type IsTypeArgumentString, KebabToCamelOptions, type NonNull, type NonUndefined, NormaliseIndentsFunction, NormaliseIndentsOptions, NormalizeIndentsFunction, NormalizeIndentsOptions, type NullableOnCondition, ONE_DAY_IN_MILLISECONDS, type OptionalOnCondition, ParallelTuple, RecordKey, RemoveUndefined, type StringListToArrayOptions, ToTitleCaseOptions, UUID_PATTERN, UUID_REGEX, VERSION_NUMBER_PATTERN, VERSION_NUMBER_REGEX, VersionNumber, type FormatOptionsBase as VersionNumberToStringOptions, VersionType, addDaysToDate, appendSemicolon, assertNotNull, az, calculateMonthlyDifference, camelToKebab, convertFileToBase64, createFormData, createTemplateStringsArray, deepCopy, deepFreeze, escapeRegexPattern, fillArray, formatDateAndTime, getRandomNumber, getRecordKeys, getStringsAndInterpolations, httpErrorCodeLookup, interpolate, interpolateObjects, isAnniversary, isLeapYear, isMonthlyMultiple, isOrdered, isSameDate, isTemplateStringsArray, kebabToCamel, normaliseIndents, normalizeIndents, omitProperties, paralleliseArrays, parseBoolean, parseEnv, parseFormData, parseIntStrict, parseUUID, parseVersionType, parseZodSchema, parseZodSchemaAsync, randomiseArray, range, removeDuplicates, removeUndefinedFromObject, sayHello, stringListToArray, stringifyDotenv, toTitleCase, truncate, wait, zodVersionNumber };
|
|
1371
|
+
export { APIError, type ArrayElement, type CallReturnType, CamelToKebabOptions, type CreateEnumType, type CreateFormDataOptions, type CreateFormDataOptionsNullableResolution, type CreateFormDataOptionsUndefinedOrNullResolution, DataError, type DisallowUndefined, Env, FILE_PATH_PATTERN, FILE_PATH_REGEX, type FormDataArrayResolutionStrategy, type FormDataNullableResolutionStrategy, type HTTPErrorCode, type IgnoreCase, type IsTypeArgumentString, KebabToCamelOptions, type NonNull, type NonUndefined, NormaliseIndentsFunction, NormaliseIndentsOptions, NormalizeIndentsFunction, NormalizeIndentsOptions, type NullableOnCondition, ONE_DAY_IN_MILLISECONDS, type OptionalOnCondition, ParallelTuple, RecordKey, RemoveUndefined, type StringListToArrayOptions, ToTitleCaseOptions, UUID_PATTERN, UUID_REGEX, VERSION_NUMBER_PATTERN, VERSION_NUMBER_REGEX, VersionNumber, type FormatOptionsBase as VersionNumberToStringOptions, VersionType, addDaysToDate, appendSemicolon, assertNotNull, assertNotNullable, assertNotUndefined, az, calculateMonthlyDifference, camelToKebab, convertFileToBase64, createFormData, createTemplateStringsArray, deepCopy, deepFreeze, escapeRegexPattern, fillArray, formatDateAndTime, getRandomNumber, getRecordKeys, getStringsAndInterpolations, httpErrorCodeLookup, interpolate, interpolateObjects, isAnniversary, isLeapYear, isMonthlyMultiple, isOrdered, isSameDate, isTemplateStringsArray, kebabToCamel, normaliseIndents, normalizeIndents, omitProperties, paralleliseArrays, parseBoolean, parseEnv, parseFormData, parseIntStrict, parseUUID, parseVersionType, parseZodSchema, parseZodSchemaAsync, randomiseArray, range, removeDuplicates, removeUndefinedFromObject, sayHello, stringListToArray, stringifyDotenv, toTitleCase, truncate, wait, zodVersionNumber };
|
package/dist/index.js
CHANGED
|
@@ -1847,4 +1847,36 @@ function assertNotNull(input) {
|
|
|
1847
1847
|
if (input === null) throw new DataError$1({ input }, "NULL_INPUT", "Expected the input not to be null");
|
|
1848
1848
|
}
|
|
1849
1849
|
//#endregion
|
|
1850
|
-
|
|
1850
|
+
//#region src/root/errors/assertNotNullable.ts
|
|
1851
|
+
/**
|
|
1852
|
+
* Asserts that a given input is not `undefined` or `null`, and throws a DataError if it does.
|
|
1853
|
+
*
|
|
1854
|
+
* If no error is thrown from this, the input type gets narrowed down to not include `undefined` or `null`.
|
|
1855
|
+
*
|
|
1856
|
+
* @template InputType The type of the input.
|
|
1857
|
+
*
|
|
1858
|
+
* @param input - The input to assert against.
|
|
1859
|
+
*
|
|
1860
|
+
* @throws {DataError} If the input is `undefined` or `null`.
|
|
1861
|
+
*/
|
|
1862
|
+
function assertNotNullable(input) {
|
|
1863
|
+
if (input === null || input === void 0) throw new DataError$1({ input }, "NULLABLE_INPUT", "Expected the input not to be undefined or null");
|
|
1864
|
+
}
|
|
1865
|
+
//#endregion
|
|
1866
|
+
//#region src/root/errors/assertNotUndefined.ts
|
|
1867
|
+
/**
|
|
1868
|
+
* Asserts that a given input is not `undefined`, and throws a DataError if it does.
|
|
1869
|
+
*
|
|
1870
|
+
* If no error is thrown from this, the input type gets narrowed down to not include `undefined`.
|
|
1871
|
+
*
|
|
1872
|
+
* @template InputType The type of the input.
|
|
1873
|
+
*
|
|
1874
|
+
* @param input - The input to assert against.
|
|
1875
|
+
*
|
|
1876
|
+
* @throws {DataError} If the input is `undefined`.
|
|
1877
|
+
*/
|
|
1878
|
+
function assertNotUndefined(input) {
|
|
1879
|
+
if (input === void 0) throw new DataError$1({ input }, "UNDEFINED_INPUT", "Expected the input not to be undefined");
|
|
1880
|
+
}
|
|
1881
|
+
//#endregion
|
|
1882
|
+
export { APIError, DataError, Env, FILE_PATH_PATTERN, FILE_PATH_REGEX, ONE_DAY_IN_MILLISECONDS, UUID_PATTERN, UUID_REGEX, VERSION_NUMBER_PATTERN, VERSION_NUMBER_REGEX, VersionNumber, VersionType, addDaysToDate, appendSemicolon, assertNotNull, assertNotNullable, assertNotUndefined, az, calculateMonthlyDifference, camelToKebab, convertFileToBase64, createFormData, createTemplateStringsArray, deepCopy, deepFreeze, escapeRegexPattern, fillArray, formatDateAndTime, getRandomNumber, getRecordKeys, getStringsAndInterpolations, httpErrorCodeLookup, interpolate, interpolateObjects, isAnniversary, isLeapYear, isMonthlyMultiple, isOrdered, isSameDate, isTemplateStringsArray, kebabToCamel, normaliseIndents, normalizeIndents, omitProperties, paralleliseArrays, parseBoolean, parseEnv, parseFormData, parseIntStrict, parseUUID, parseVersionType, parseZodSchema, parseZodSchemaAsync, randomiseArray, range, removeDuplicates, removeUndefinedFromObject, sayHello, stringListToArray, stringifyDotenv, toTitleCase, truncate, wait, zodVersionNumber };
|
|
@@ -147,7 +147,7 @@ declare class DataError<DataType extends object = Record<PropertyKey, unknown>,
|
|
|
147
147
|
*
|
|
148
148
|
* @returns The `DataError` that was thrown by the `errorFunction`
|
|
149
149
|
*/
|
|
150
|
-
static expectError<DataType extends Record<PropertyKey, unknown>, ErrorCode extends string = string>(errorFunction: () => unknown, options?: ExpectErrorOptions<ErrorCode>): DataError<DataType, ErrorCode>;
|
|
150
|
+
static expectError<DataType extends object = Record<PropertyKey, unknown>, ErrorCode extends string = string>(errorFunction: () => unknown, options?: ExpectErrorOptions<ErrorCode>): DataError<DataType, ErrorCode>;
|
|
151
151
|
/**
|
|
152
152
|
* 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.
|
|
153
153
|
*
|
|
@@ -159,7 +159,7 @@ declare class DataError<DataType extends object = Record<PropertyKey, unknown>,
|
|
|
159
159
|
*
|
|
160
160
|
* @returns The `DataError` that was thrown by the `errorFunction`
|
|
161
161
|
*/
|
|
162
|
-
static expectErrorAsync<DataType extends Record<PropertyKey, unknown>, ErrorCode extends string = string>(errorFunction: () => Promise<unknown>, options?: ExpectErrorOptions<ErrorCode>): Promise<DataError<DataType, ErrorCode>>;
|
|
162
|
+
static expectErrorAsync<DataType extends object = Record<PropertyKey, unknown>, ErrorCode extends string = string>(errorFunction: () => Promise<unknown>, options?: ExpectErrorOptions<ErrorCode>): Promise<DataError<DataType, ErrorCode>>;
|
|
163
163
|
/**
|
|
164
164
|
* Converts the `DataError` instance to a serialised JSON payload.
|
|
165
165
|
*
|
package/dist/internal/index.d.ts
CHANGED
|
@@ -147,7 +147,7 @@ declare class DataError<DataType extends object = Record<PropertyKey, unknown>,
|
|
|
147
147
|
*
|
|
148
148
|
* @returns The `DataError` that was thrown by the `errorFunction`
|
|
149
149
|
*/
|
|
150
|
-
static expectError<DataType extends Record<PropertyKey, unknown>, ErrorCode extends string = string>(errorFunction: () => unknown, options?: ExpectErrorOptions<ErrorCode>): DataError<DataType, ErrorCode>;
|
|
150
|
+
static expectError<DataType extends object = Record<PropertyKey, unknown>, ErrorCode extends string = string>(errorFunction: () => unknown, options?: ExpectErrorOptions<ErrorCode>): DataError<DataType, ErrorCode>;
|
|
151
151
|
/**
|
|
152
152
|
* 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.
|
|
153
153
|
*
|
|
@@ -159,7 +159,7 @@ declare class DataError<DataType extends object = Record<PropertyKey, unknown>,
|
|
|
159
159
|
*
|
|
160
160
|
* @returns The `DataError` that was thrown by the `errorFunction`
|
|
161
161
|
*/
|
|
162
|
-
static expectErrorAsync<DataType extends Record<PropertyKey, unknown>, ErrorCode extends string = string>(errorFunction: () => Promise<unknown>, options?: ExpectErrorOptions<ErrorCode>): Promise<DataError<DataType, ErrorCode>>;
|
|
162
|
+
static expectErrorAsync<DataType extends object = Record<PropertyKey, unknown>, ErrorCode extends string = string>(errorFunction: () => Promise<unknown>, options?: ExpectErrorOptions<ErrorCode>): Promise<DataError<DataType, ErrorCode>>;
|
|
163
163
|
/**
|
|
164
164
|
* Converts the `DataError` instance to a serialised JSON payload.
|
|
165
165
|
*
|
package/dist/v6/index.d.cts
CHANGED
|
@@ -146,7 +146,7 @@ declare class APIError<DataType extends object = Record<PropertyKey, unknown>, E
|
|
|
146
146
|
*
|
|
147
147
|
* @returns The `APIError` that was thrown by the `errorFunction`
|
|
148
148
|
*/
|
|
149
|
-
static expectError<DataType extends Record<PropertyKey, unknown>, ErrorCode extends string = string>(errorFunction: () => unknown, options?: ExpectErrorOptions<ErrorCode>): APIError<DataType, ErrorCode>;
|
|
149
|
+
static expectError<DataType extends object = Record<PropertyKey, unknown>, ErrorCode extends string = string>(errorFunction: () => unknown, options?: ExpectErrorOptions<ErrorCode>): APIError<DataType, ErrorCode>;
|
|
150
150
|
/**
|
|
151
151
|
* Gets the thrown `APIError` from a given asynchronous function if one was thrown, and re-throws any other errors, or throws a default `APIError` if no error thrown.
|
|
152
152
|
*
|
|
@@ -158,7 +158,7 @@ declare class APIError<DataType extends object = Record<PropertyKey, unknown>, E
|
|
|
158
158
|
*
|
|
159
159
|
* @returns The `APIError` that was thrown by the `errorFunction`
|
|
160
160
|
*/
|
|
161
|
-
static expectErrorAsync<DataType extends Record<PropertyKey, unknown>, ErrorCode extends string = string>(errorFunction: () => Promise<unknown>, options?: ExpectErrorOptions<ErrorCode>): Promise<APIError<DataType, ErrorCode>>;
|
|
161
|
+
static expectErrorAsync<DataType extends object = Record<PropertyKey, unknown>, ErrorCode extends string = string>(errorFunction: () => Promise<unknown>, options?: ExpectErrorOptions<ErrorCode>): Promise<APIError<DataType, ErrorCode>>;
|
|
162
162
|
/**
|
|
163
163
|
* Create a new `APIError` with the error code derived from the status directly.
|
|
164
164
|
*
|
|
@@ -228,7 +228,7 @@ declare class DataError<DataType extends object = Record<PropertyKey, unknown>,
|
|
|
228
228
|
*
|
|
229
229
|
* @returns The `DataError` that was thrown by the `errorFunction`
|
|
230
230
|
*/
|
|
231
|
-
static expectError<DataType extends Record<PropertyKey, unknown>, ErrorCode extends string = string>(errorFunction: () => unknown, options?: ExpectErrorOptions<ErrorCode>): DataError<DataType, ErrorCode>;
|
|
231
|
+
static expectError<DataType extends object = Record<PropertyKey, unknown>, ErrorCode extends string = string>(errorFunction: () => unknown, options?: ExpectErrorOptions<ErrorCode>): DataError<DataType, ErrorCode>;
|
|
232
232
|
/**
|
|
233
233
|
* 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.
|
|
234
234
|
*
|
|
@@ -240,7 +240,7 @@ declare class DataError<DataType extends object = Record<PropertyKey, unknown>,
|
|
|
240
240
|
*
|
|
241
241
|
* @returns The `DataError` that was thrown by the `errorFunction`
|
|
242
242
|
*/
|
|
243
|
-
static expectErrorAsync<DataType extends Record<PropertyKey, unknown>, ErrorCode extends string = string>(errorFunction: () => Promise<unknown>, options?: ExpectErrorOptions<ErrorCode>): Promise<DataError<DataType, ErrorCode>>;
|
|
243
|
+
static expectErrorAsync<DataType extends object = Record<PropertyKey, unknown>, ErrorCode extends string = string>(errorFunction: () => Promise<unknown>, options?: ExpectErrorOptions<ErrorCode>): Promise<DataError<DataType, ErrorCode>>;
|
|
244
244
|
/**
|
|
245
245
|
* Converts the `DataError` instance to a serialised JSON payload.
|
|
246
246
|
*
|
package/dist/v6/index.d.ts
CHANGED
|
@@ -146,7 +146,7 @@ declare class APIError<DataType extends object = Record<PropertyKey, unknown>, E
|
|
|
146
146
|
*
|
|
147
147
|
* @returns The `APIError` that was thrown by the `errorFunction`
|
|
148
148
|
*/
|
|
149
|
-
static expectError<DataType extends Record<PropertyKey, unknown>, ErrorCode extends string = string>(errorFunction: () => unknown, options?: ExpectErrorOptions<ErrorCode>): APIError<DataType, ErrorCode>;
|
|
149
|
+
static expectError<DataType extends object = Record<PropertyKey, unknown>, ErrorCode extends string = string>(errorFunction: () => unknown, options?: ExpectErrorOptions<ErrorCode>): APIError<DataType, ErrorCode>;
|
|
150
150
|
/**
|
|
151
151
|
* Gets the thrown `APIError` from a given asynchronous function if one was thrown, and re-throws any other errors, or throws a default `APIError` if no error thrown.
|
|
152
152
|
*
|
|
@@ -158,7 +158,7 @@ declare class APIError<DataType extends object = Record<PropertyKey, unknown>, E
|
|
|
158
158
|
*
|
|
159
159
|
* @returns The `APIError` that was thrown by the `errorFunction`
|
|
160
160
|
*/
|
|
161
|
-
static expectErrorAsync<DataType extends Record<PropertyKey, unknown>, ErrorCode extends string = string>(errorFunction: () => Promise<unknown>, options?: ExpectErrorOptions<ErrorCode>): Promise<APIError<DataType, ErrorCode>>;
|
|
161
|
+
static expectErrorAsync<DataType extends object = Record<PropertyKey, unknown>, ErrorCode extends string = string>(errorFunction: () => Promise<unknown>, options?: ExpectErrorOptions<ErrorCode>): Promise<APIError<DataType, ErrorCode>>;
|
|
162
162
|
/**
|
|
163
163
|
* Create a new `APIError` with the error code derived from the status directly.
|
|
164
164
|
*
|
|
@@ -228,7 +228,7 @@ declare class DataError<DataType extends object = Record<PropertyKey, unknown>,
|
|
|
228
228
|
*
|
|
229
229
|
* @returns The `DataError` that was thrown by the `errorFunction`
|
|
230
230
|
*/
|
|
231
|
-
static expectError<DataType extends Record<PropertyKey, unknown>, ErrorCode extends string = string>(errorFunction: () => unknown, options?: ExpectErrorOptions<ErrorCode>): DataError<DataType, ErrorCode>;
|
|
231
|
+
static expectError<DataType extends object = Record<PropertyKey, unknown>, ErrorCode extends string = string>(errorFunction: () => unknown, options?: ExpectErrorOptions<ErrorCode>): DataError<DataType, ErrorCode>;
|
|
232
232
|
/**
|
|
233
233
|
* 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.
|
|
234
234
|
*
|
|
@@ -240,7 +240,7 @@ declare class DataError<DataType extends object = Record<PropertyKey, unknown>,
|
|
|
240
240
|
*
|
|
241
241
|
* @returns The `DataError` that was thrown by the `errorFunction`
|
|
242
242
|
*/
|
|
243
|
-
static expectErrorAsync<DataType extends Record<PropertyKey, unknown>, ErrorCode extends string = string>(errorFunction: () => Promise<unknown>, options?: ExpectErrorOptions<ErrorCode>): Promise<DataError<DataType, ErrorCode>>;
|
|
243
|
+
static expectErrorAsync<DataType extends object = Record<PropertyKey, unknown>, ErrorCode extends string = string>(errorFunction: () => Promise<unknown>, options?: ExpectErrorOptions<ErrorCode>): Promise<DataError<DataType, ErrorCode>>;
|
|
244
244
|
/**
|
|
245
245
|
* Converts the `DataError` instance to a serialised JSON payload.
|
|
246
246
|
*
|