npm.io
0.1.5 • Published 2 years ago

@types/nssm

Licence
MIT
Version
0.1.5
Deps
0
Size
5 kB
Vulns
0
Weekly
0
Stars
51.4K

Installation

npm install --save @types/nssm

Summary

This package contains type definitions for nssm (https://github.com/alykoshin/nssm).

Details

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

index.d.ts

type Command =
    | "install"
    | "remove"
    | "start"
    | "stop"
    | "restart"
    | "status"
    | "pause"
    | "continue"
    | "rotate"
    | "get"
    | "set"
    | "reset";

type NssmThen<T> = <TResult1 = T, TResult2 = never>(
    onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null,
    onrejected?: ((reason: Error, stderr: string) => TResult2 | PromiseLike<TResult2>) | null,
) => NssmPromise<TResult1 | TResult2>;

type NssmCatch<T> = <TResult = never>(
    onrejected?: ((reason: Error, stderr: string) => TResult | PromiseLike<TResult>) | null,
) => NssmPromise<T | TResult>;

interface NssmPromise<T> extends Promise<T> {
    then: NssmThen<T>;
    catch: NssmCatch<T>;
}

type CallbackFn = (error?: string, result?: string) => void;
type ZeroArgCommandFn = (callback: CallbackFn) => void;
type OneArgCommandFn = (arg1: string, callback: CallbackFn) => void;
type TwoArgCommandFn = (arg1: string, arg2: string, callback: CallbackFn) => void;
type PromiseCommandFn = (arg1?: string, arg2?: string) => NssmPromise<string>;

type NssmCommandFn =
    & ZeroArgCommandFn
    & OneArgCommandFn
    & TwoArgCommandFn
    & PromiseCommandFn;

export = nssm;

declare function nssm(serviceName: string, options?: nssm.NssmOptions): nssm.Nssm;

declare namespace nssm {
    type Nssm = {
        [key in Command]: NssmCommandFn;
    };

    interface NssmOptions {
        nssmExe?: string | undefined;
    }
}

Additional Details

  • Last updated: Tue, 07 Nov 2023 0939 GMT
  • Dependencies: none

Credits

These definitions were written by Joram van den Boezem.