Merge pull request #31329 from BendingBender/resolve-pkg

resolve-pkg: Export options interface along with module definition
This commit is contained in:
Nathan Shively-Sanders
2018-12-17 10:36:14 -08:00
committed by GitHub
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 = {};