@types/nssm
TypeScript icon, indicating that this package has built-in type declarations

0.1.5 • Public • Published

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 09:09:39 GMT
  • Dependencies: none

Credits

These definitions were written by Joram van den Boezem.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/nssm

Weekly Downloads

16

Version

0.1.5

License

MIT

Unpacked Size

5.39 kB

Total Files

5

Last publish

Collaborators

  • types