From 1f850c3ff3148c2b8ac42bb520caccd1fffa526c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=A5=BA?= Date: Mon, 22 Jan 2018 18:05:41 +0800 Subject: [PATCH] Closes #10 --- index.d.ts | 7 +++++++ test/types/test.ts | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/index.d.ts b/index.d.ts index e7bbe78..e4a6287 100644 --- a/index.d.ts +++ b/index.d.ts @@ -19,6 +19,13 @@ declare namespace PluginError { */ new (plugin: string, error: E, options?: Options): PluginError; + /** + * @param plugin Plugin name + * @param error Base error / Error message + * @param options Error options + */ + new (plugin: string, error: E | string, options?: Options): PluginError | PluginError; + /** * @param plugin Plugin name * @param options Options with message diff --git a/test/types/test.ts b/test/types/test.ts index 1ff1b38..d08e56e 100644 --- a/test/types/test.ts +++ b/test/types/test.ts @@ -51,3 +51,10 @@ import PluginError = require("plugin-error"); } } +{ + const PLUGIN_NAME = 'test' + + function createPluginError(err: Error | string) { + return new PluginError(PLUGIN_NAME, err); + } +}