[package-json] fix wrong return type

I made a mistake in my original PR
https://github.com/DefinitelyTyped/DefinitelyTyped/pull/21578

The function should return a promise.
- https://www.npmjs.com/package/package-json
- https://github.com/sindresorhus/package-json/blob/master/index.js#L30
This commit is contained in:
Jinwoo Lee
2017-11-16 14:11:03 -08:00
parent 17f759f936
commit aedb3fb018
2 changed files with 5 additions and 2 deletions

View File

@@ -9,6 +9,6 @@ interface PackageJsonOptions {
allVersions?: boolean;
}
declare function packageJson(name: string, options?: PackageJsonOptions): {};
declare function packageJson(name: string, options?: PackageJsonOptions): Promise<{}>;
export = packageJson;

View File

@@ -1,7 +1,10 @@
import packageJson = require('package-json');
const pkg = packageJson('package-json', {
let pkg: {};
packageJson('package-json', {
version: '1.2.3',
fullMetadata: true,
allVersions: true,
}).then(x => {
pkg = x;
});