diff --git a/types/resolve-pkg/index.d.ts b/types/resolve-pkg/index.d.ts index 06a706acbe..61d9fd3152 100644 --- a/types/resolve-pkg/index.d.ts +++ b/types/resolve-pkg/index.d.ts @@ -1,14 +1,15 @@ // Type definitions for resolve-pkg 1.0 // Project: https://github.com/sindresorhus/resolve-pkg // Definitions by: Meno Abels +// 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; diff --git a/types/resolve-pkg/resolve-pkg-tests.ts b/types/resolve-pkg/resolve-pkg-tests.ts index caa949a11e..e4540e2ee9 100644 --- a/types/resolve-pkg/resolve-pkg-tests.ts +++ b/types/resolve-pkg/resolve-pkg-tests.ts @@ -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 = {};