@types/which
Type definitions for which 1.0.8 from https://www.github.com/DefinitelyTyped/DefinitelyTyped
Last updated 10 years ago by types .
MIT · Original npm · Tarball · package.json
$ cnpm install @types/which 
SYNC missed versions from official npm registry.

Installation

npm install --save @types/which

Summary

This package contains type definitions for which (https://github.com/isaacs/node-which).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/which.

index.d.ts

/** Finds all instances of a specified executable in the PATH environment variable */

type AppendNullIfNothrow<TOptions, TRet> = TOptions extends { nothrow: infer TVal }
    // nothrow is specified
    ? TVal extends false
        // TVal is false
        ? TRet
        // TVal is boolean or true
    : TRet | null
    // nothrow not specified
    : TRet;

type TransformToArrayIfAll<TOptions, TRet> = TOptions extends { all: infer TVal }
    // all is specified
    ? TVal extends true
        // TVal is true
        ? readonly TRet[]
    : TVal extends false
        // TVal is false
        ? TRet
        // TVal is boolean
    : readonly TRet[] | TRet
    // all not specified
    : TRet;

type ReturnType<TOptions> = AppendNullIfNothrow<TOptions, TransformToArrayIfAll<TOptions, string>>;

type Exact<T, U extends T> = {
    [Key in keyof U]: Key extends keyof T ? U[Key]
        : never;
};

declare function which<TOptions extends which.Options>(
    cmd: string,
    options?: Exact<which.Options, TOptions>,
): Promise<ReturnType<Exact<which.Options, TOptions>>>;

declare namespace which {
    /** Finds all instances of a specified executable in the PATH environment variable */
    function sync<TOptions extends Options>(
        cmd: string,
        options?: Exact<Options, TOptions>,
    ): ReturnType<Exact<Options, TOptions>>;

    /** Options for which() API */
    interface Options {
        /** 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. */
        all?: boolean | undefined;
        /** Use instead of the PATH environment variable. */
        path?: string | undefined;
        /** Use instead of the PATHEXT environment variable. */
        pathExt?: string | undefined;
        /** Use instead of the platform's native path separator. */
        delimiter?: string | undefined;
        /** If true, returns null when not found */
        nothrow?: boolean | undefined;
    }
}

export = which;

Additional Details

  • Last updated: Thu, 30 May 2024 17:35:42 GMT
  • Dependencies: none

Credits

These definitions were written by vvakame, cspotcode, and Piotr Błażejewicz.

Current Tags

  • 3.0.4                                ...           latest (2 years ago)
  • 1.3.2                                ...           ts2.0 (7 years ago)
  • 1.3.2                                ...           ts2.1 (7 years ago)
  • 1.3.2                                ...           ts2.2 (7 years ago)
  • 1.3.2                                ...           ts2.3 (7 years ago)
  • 1.3.2                                ...           ts2.4 (7 years ago)
  • 1.3.2                                ...           ts2.5 (7 years ago)
  • 1.3.2                                ...           ts2.6 (7 years ago)
  • 1.3.2                                ...           ts2.7 (7 years ago)
  • 1.3.2                                ...           ts2.8 (7 years ago)
  • 1.3.2                                ...           ts2.9 (7 years ago)
  • 1.3.2                                ...           ts3.0 (7 years ago)
  • 1.3.2                                ...           ts3.1 (7 years ago)
  • 1.3.2                                ...           ts3.2 (7 years ago)
  • 2.0.0                                ...           ts3.3 (5 years ago)
  • 2.0.0                                ...           ts3.4 (5 years ago)
  • 2.0.0                                ...           ts3.5 (5 years ago)
  • 2.0.1                                ...           ts3.6 (5 years ago)
  • 2.0.1                                ...           ts3.7 (5 years ago)
  • 2.0.1                                ...           ts3.8 (5 years ago)
  • 2.0.1                                ...           ts3.9 (5 years ago)
  • 2.0.1                                ...           ts4.0 (5 years ago)
  • 2.0.1                                ...           ts4.1 (5 years ago)
  • 2.0.2                                ...           ts4.2 (3 years ago)
  • 3.0.0                                ...           ts4.3 (3 years ago)
  • 3.0.0                                ...           ts4.4 (3 years ago)
  • 3.0.3                                ...           ts4.5 (2 years ago)
  • 3.0.3                                ...           ts4.6 (2 years ago)
  • 3.0.4                                ...           ts4.7 (2 years ago)
  • 3.0.4                                ...           ts4.8 (2 years ago)
  • 3.0.4                                ...           ts4.9 (2 years ago)
  • 3.0.4                                ...           ts5.0 (2 years ago)
  • 3.0.4                                ...           ts5.1 (2 years ago)
  • 3.0.4                                ...           ts5.2 (2 years ago)
  • 3.0.4                                ...           ts5.3 (2 years ago)
  • 3.0.4                                ...           ts5.4 (2 years ago)
  • 3.0.4                                ...           ts5.5 (2 years ago)
  • 3.0.4                                ...           ts5.6 (2 years ago)
  • 3.0.4                                ...           ts5.7 (2 years ago)
  • 3.0.4                                ...           ts5.8 (2 years ago)
  • 3.0.4                                ...           ts5.9 (2 years ago)

22 Versions

  • 3.0.4                                ...           2 years ago
  • 3.0.3                                ...           2 years ago
  • 3.0.2                                ...           2 years ago
  • 3.0.1                                ...           2 years ago
  • 3.0.0                                ...           3 years ago
  • 2.0.2                                ...           3 years ago
  • 2.0.1                                ...           5 years ago
  • 2.0.0                                ...           5 years ago
  • 1.3.2                                ...           7 years ago
  • 1.3.1                                ...           8 years ago
  • 1.3.0                                ...           8 years ago
  • 1.0.28                                ...           10 years ago
  • 1.0.27                                ...           10 years ago
  • 1.0.26-alpha                                ...           10 years ago
  • 1.0.25-alpha                                ...           10 years ago
  • 1.0.24-alpha                                ...           10 years ago
  • 1.0.23-alpha                                ...           10 years ago
  • 1.0.22-alpha                                ...           10 years ago
  • 1.0.21-alpha                                ...           10 years ago
  • 1.0.20-alpha                                ...           10 years ago
  • 1.0.15-alpha                                ...           10 years ago
  • 1.0.14-alpha                                ...           10 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 1
Last Month 1
Dependencies (0)
None
Dev Dependencies (0)
None

Copyright 2013 - present © cnpmjs.org | Home |