DefinitelyTyped/types/which-pm/which-pm-tests.ts
Jorge Gonzalez 3d328af508 Add types for which-pm@1.0 (#27543)
* Add types for which-pm@1.0

* Move reference types to which-pm-tests.ts
2018-07-24 11:24:45 -07:00

15 lines
432 B
TypeScript

/// <reference types="node" />
import whichpm = require("which-pm");
whichpm(process.cwd())
.then(pm => {
pm; // $ExpectType PMInfo | null
if (pm !== null && pm !== undefined) {
pm.name; // $ExpectType string
pm.version; // $ExpectType string | undefined
}
})
.catch(err => console.error(err));
const _wpm = whichpm(process.cwd()); // $ExpectType Promise<PMInfo | null>