• Version 2.0.0
  • Published
  • 5.81 kB
  • No dependencies
  • MIT license


npm i @types/which
yarn add @types/which
pnpm add @types/which


TypeScript definitions for which



function sync

sync: {
cmd: string,
options: Options & OptionsAll & OptionsNoThrow
): ReadonlyArray<string> | null;
(cmd: string, options: Options & OptionsFirst & OptionsNoThrow): string;
(cmd: string, options: Options & OptionsAll & OptionsThrow): readonly string[];
(cmd: string, options?: Options & OptionsFirst & OptionsThrow): string;
(cmd: string, options: Options): string | readonly string[];
  • Finds all instances of a specified executable in the PATH environment variable

function which

which: typeof which;
  • Finds all instances of a specified executable in the PATH environment variable


interface AsyncOptions

interface AsyncOptions {}
  • Options for which() async API

property all

all?: boolean;
  • If true, return all matches, instead of just the first one. Note that this means the function returns an array of strings instead of a single string.

property path

path?: string;
  • Use instead of the PATH environment variable.

property pathExt

pathExt?: string;
  • Use instead of the PATHEXT environment variable.

interface Options

interface Options extends AsyncOptions {}
  • Options for which() sync and async APIs

property nothrow

nothrow?: boolean;
  • If true, returns null when not found

interface OptionsAll

interface OptionsAll extends AsyncOptions {}
  • Options that ask for all matches.

property all

all: true;

    interface OptionsFirst

    interface OptionsFirst extends AsyncOptions {}
    • Options that ask for the first match (the default behavior)

    property all

    all?: false;

      interface OptionsNoThrow

      interface OptionsNoThrow extends Options {}
      • Options that ask to receive null instead of a thrown error

      property nothrow

      nothrow: true;

        interface OptionsThrow

        interface OptionsThrow extends Options {}
        • Options that ask for a thrown error if executable is not found (the default behavior)

        property nothrow

        nothrow?: false;

          Package Files (1)

          Dependencies (0)

          No dependencies.

          Dev Dependencies (0)

          No dev dependencies.

          Peer Dependencies (0)

          No peer dependencies.


          To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

          You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/which.

          • Markdown
          • HTML
            <a href="https://www.jsdocs.io/package/@types/which"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>