create-error-types
Advanced tools
Comparing version 1.0.5 to 1.0.6
@@ -1,4 +0,13 @@ | ||
import { ErrorName, OnCreate, ErrorType, ErrorParams } from 'error-type' | ||
import { | ||
ErrorName, | ||
OnCreate, | ||
ErrorInstance, | ||
ErrorConstructor, | ||
ErrorParams, | ||
} from 'error-type' | ||
export interface Options<T extends ErrorParams = ErrorParams> { | ||
export interface Options< | ||
ErrorNamesArg extends ErrorName = ErrorName, | ||
ErrorParamsArg extends ErrorParams = ErrorParams, | ||
> { | ||
/** | ||
@@ -32,3 +41,3 @@ * URL where users should report internal errors/bugs. | ||
*/ | ||
onCreate?: OnCreate<T> | ||
onCreate?: OnCreate<ErrorNamesArg, ErrorParamsArg> | ||
} | ||
@@ -50,4 +59,7 @@ | ||
*/ | ||
export type Result<T extends ErrorParams = ErrorParams> = { | ||
[errorName in ErrorName]: typeof ErrorType<T> | ||
export type Result< | ||
ErrorNamesArg extends ErrorName = ErrorName, | ||
ErrorParamsArg extends ErrorParams = ErrorParams, | ||
> = { | ||
[errorName in ErrorNamesArg]: ErrorConstructor<errorName, ErrorParamsArg> | ||
} & { | ||
@@ -74,3 +86,9 @@ /** | ||
export type { ErrorName, OnCreate, ErrorType, ErrorParams } | ||
export type { | ||
ErrorName, | ||
OnCreate, | ||
ErrorInstance, | ||
ErrorConstructor, | ||
ErrorParams, | ||
} | ||
@@ -90,4 +108,7 @@ /** | ||
*/ | ||
export default function createErrorTypes<T extends ErrorParams = ErrorParams>( | ||
options?: Options<T>, | ||
): Result<T> | ||
export default function createErrorTypes< | ||
ErrorNamesArg extends ErrorName = ErrorName, | ||
ErrorParamsArg extends ErrorParams = ErrorParams, | ||
>( | ||
options?: Options<ErrorNamesArg, ErrorParamsArg>, | ||
): Result<ErrorNamesArg, ErrorParamsArg> |
{ | ||
"name": "create-error-types", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"type": "module", | ||
@@ -49,3 +49,3 @@ "exports": "./build/src/main.js", | ||
"dependencies": { | ||
"error-type": "^1.3.1", | ||
"error-type": "^2.0.0", | ||
"is-plain-obj": "^4.1.0", | ||
@@ -52,0 +52,0 @@ "normalize-exception": "^1.6.0" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
28845
222
+ Addederror-type@2.0.1(transitive)
- Removederror-type@1.3.1(transitive)
Updatederror-type@^2.0.0