mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-28 16:45:10 +08:00
15 lines
432 B
TypeScript
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>
|