stephenlacy / bump-regex

bump regex with semver
MIT License
13 stars 10 forks source link

Add typescript typings #16

Closed silkentrance closed 6 years ago

silkentrance commented 6 years ago

Please add typescript typings to bump-regex as bump-regex/index.d.ts.

An initial working first stab at this would be

/// <reference types="node"/>

declare function BumpRegex(opts : string|BumpRegex.Options, cb : BumpRegex.Callback) : any|null;

declare namespace BumpRegex {

  declare function Callback(err : string|Error|null, opts?: Result) : any|null;

  interface Options {
    type? : 'major' | 'minor' | 'patch' | 'prerelease';
    version?: string;
    str?: string;
    key?: string;
    keys?: Array<string>;
    case?: boolean;
    global?: boolean;
    preid?: string;
    regex?: Regex;
  }

  interface Result extends Options {
    prev: string;
    new: string;
  }
}

export = BumpRegex;
silkentrance commented 6 years ago

Of course this would also require some typescript integration tests, adding additional dev dependencies to the project.

silkentrance commented 6 years ago

@stevelacy I have made a PR for this over at DefinitelyTyped. See https://github.com/DefinitelyTyped/DefinitelyTyped/pull/22104

stephenlacy commented 6 years ago

Closing since the PR was merged