diff --git a/types/bump-regex/bump-regex-tests.ts b/types/bump-regex/bump-regex-tests.ts new file mode 100644 index 0000000000..e7a54ada8e --- /dev/null +++ b/types/bump-regex/bump-regex-tests.ts @@ -0,0 +1,22 @@ +import * as bump from 'bump-regex'; + +bump({}, (err, res) => { + if (err) {} + if (res) { + res.new; + res.prev; + } +}); + +bump('1.0.0', (err, res) => {}); + +bump({type: 'major', str: '1.0.0'}, (err, res) => {}); +bump({type: 'minor', str: '1.0.0'}, (err, res) => {}); +bump({type: 'patch', str: '1.0.0'}, (err, res) => {}); +bump({type: 'prerelease', str: '1.0.0'}, (err, res) => {}); + +bump({regex: /^.+$/, str: '1.0.0'}, (err, res) => {}); + +bump({regex: /^.+$/, global: true, str: '1.0.0'}, (err, res) => {}); + +bump({regex: /^.+$/, case: true, str: '1.0.0'}, (err, res) => {}); diff --git a/types/bump-regex/index.d.ts b/types/bump-regex/index.d.ts new file mode 100644 index 0000000000..47910b9517 --- /dev/null +++ b/types/bump-regex/index.d.ts @@ -0,0 +1,29 @@ +// Type definitions for bump-regex 2.9 +// Project: https://github.com/stevelacy/bump-regex +// Definitions by: silkentrance +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare function BumpRegex(opts: string|BumpRegex.Options, cb: BumpRegex.Callback): any; + +declare namespace BumpRegex { + type Callback = (err: string|Error|null, opts?: Result) => void; + + interface Options { + key?: string; + type?: 'major' | 'minor' | 'patch' | 'prerelease'; + case?: boolean; + keys?: string[]; + global?: boolean; + version?: string; + preid?: string; + regex?: RegExp; + str?: string; + } + + interface Result extends Options { + prev: string; + new: string; + } +} + +export = BumpRegex; diff --git a/types/bump-regex/tsconfig.json b/types/bump-regex/tsconfig.json new file mode 100644 index 0000000000..001effea6a --- /dev/null +++ b/types/bump-regex/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "bump-regex-tests.ts" + ] +} diff --git a/types/bump-regex/tslint.json b/types/bump-regex/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/bump-regex/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +}