@types/find-pkg
v2.0.0
Published
TypeScript definitions for find-pkg
Readme
Installation
npm install --save @types/find-pkg
Summary
This package contains type definitions for find-pkg (https://github.com/jonschlinkert/find-pkg).
Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/find-pkg.
index.d.ts
/**
* Find the first directory with a package.json, recursing up from the given directory.
*
* @param cwd - The directory to start searching from
* @returns A promise that resolves to the path of the found package.json, or undefined if not found
*
* @example
* ```javascript
* const findPkg = require('find-pkg');
*
* findPkg('a/b/c/some/path')
* .then(file => console.log(file))
* .catch(console.error);
* ```
*/
declare function findPkg(cwd: string): Promise<string | undefined>;
/**
* Find the first directory with a package.json, recursing up from the given directory.
*
* @param cwd - The directory to start searching from
* @param callback - Callback function called with (err, filepath)
*
* @example
* ```javascript
* findPkg('a/b/c/some/path', function(err, file) {
* if (err) throw err;
* console.log(file);
* });
* ```
*/
declare function findPkg(cwd: string, callback: (err: Error | null, file: string | undefined) => void): void;
declare namespace findPkg {
/**
* Synchronously find the first directory with a package.json, recursing up from the given directory.
*
* @param cwd - The directory to start searching from
* @returns The path of the found package.json, or undefined if not found
*
* @example
* ```javascript
* const file = findPkg.sync('a/b/c/some/path');
* ```
*/
function sync(cwd: string): string | undefined;
}
export = findPkg;
Additional Details
- Last updated: Thu, 05 Feb 2026 08:45:22 GMT
- Dependencies: none
Credits
These definitions were written by Jon Schlinkert, and gaspard.
