diff --git a/index.d.ts b/index.d.ts new file mode 100644 index 0000000..63ebd2a --- /dev/null +++ b/index.d.ts @@ -0,0 +1,16 @@ +export type Scalar = number | string | boolean | bigint | null | undefined; +export interface Err extends Error, Ext { + code: Code +} + +interface CreateError { + ( + reason:string|Error, + code:Code, + ext:Ext + ):Err + (reason:string|Error, code:Code):Err +} + +declare var createError:CreateError +exports = createError diff --git a/package.json b/package.json index fb8624c..b25734c 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "version": "2.0.3", "description": "Create an error with a code", "main": "index.js", + "types": "index.d.ts", "scripts": { "lint": "eslint '{*.js,test/**/*.js}' --ignore-pattern *.umd.js", "test": "mocha --bail",