Export options interface along with module definition

This commit is contained in:
Dimitri Benin
2018-12-12 21:11:15 +01:00
parent 73a3ac3c9f
commit 62efd5c093
2 changed files with 16 additions and 11 deletions
+9 -8
View File
@@ -1,14 +1,15 @@
// Type definitions for resolve-pkg 1.0
// Project: https://github.com/sindresorhus/resolve-pkg
// Definitions by: Meno Abels <https://github.com/mabels>
// BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.9
interface ResolvePkgOptions {
cwd?: boolean;
export = resolvePkg;
declare function resolvePkg(moduleId: string, options?: resolvePkg.Options): string;
declare namespace resolvePkg {
interface Options {
cwd?: boolean;
}
}
type ResolveFunction = (moduleId: string, options?: ResolvePkgOptions) => string;
declare const resolveFunction: ResolveFunction;
export = resolveFunction;
+7 -3
View File
@@ -1,5 +1,9 @@
import rpkg = require('resolve-pkg');
import resolvePkg = require('resolve-pkg');
const test1 = rpkg('hello');
const test2 = rpkg('hello', {});
const test3 = rpkg('hello', { cwd: true });
// $ExpectType string
rpkg('hello');
rpkg('hello', {});
rpkg('hello', { cwd: true });
const resolvePkgOpts: resolvePkg.Options = {};