diff --git a/types/pify/index.d.ts b/types/pify/index.d.ts index fc4b13df5d..b0c8ce4b92 100644 --- a/types/pify/index.d.ts +++ b/types/pify/index.d.ts @@ -9,8 +9,8 @@ interface PromiseModule { interface PifyOptions { multiArgs?: boolean, - include?: [string | RegExp], - exclude?: [string | RegExp], + include?: Array, + exclude?: Array, excludeMain?: boolean, errorFirst?: boolean, promiseModule?: PromiseModule diff --git a/types/pify/pify-tests.ts b/types/pify/pify-tests.ts index 27022b7390..cadf3ba408 100644 --- a/types/pify/pify-tests.ts +++ b/types/pify/pify-tests.ts @@ -31,3 +31,20 @@ pify(fs.readFile, { promiseModule: Promise})('bar.txt').then((result: string) => pify(fs.exists, { errorFirst: false })('foo.txt').then((result: boolean) => assert(result.toString(), true.toString())); + +// include/exclude with multiple entries +const module = { + f1: (callback: Function) => callback(), + f2: (callback: Function) => callback(), + f3: (callback: Function) => callback(), +}; + +const include = pify(module, { include: ['f1', 'f2'] }); +if (include.f1 === module.f1) throw new Error(); +if (include.f2 === module.f2) throw new Error(); +if (include.f3 !== module.f3) throw new Error(); + +const exclude = pify(module, { exclude: ['f1', 'f2'] }); +if (include.f1 !== module.f1) throw new Error(); +if (include.f2 !== module.f2) throw new Error(); +if (include.f3 === module.f3) throw new Error();