diff --git a/types/to-semver/index.d.ts b/types/to-semver/index.d.ts new file mode 100644 index 0000000000..813c77378d --- /dev/null +++ b/types/to-semver/index.d.ts @@ -0,0 +1,26 @@ +// Type definitions for to-semver 1.1 +// Project: https://github.com/sindresorhus/to-semver#readme +// Definitions by: BendingBender +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export = toSemver; + +/** + * Get an array of valid, sorted, and cleaned [semver](http://semver.org/) versions from an array of strings. + */ +declare function toSemver(versions: string[], options?: toSemver.Options): string[]; + +declare namespace toSemver { + interface Options { + /** + * Include prereleases, like `1.2.3-alpha.3`. + * @default true + */ + includePrereleases?: boolean; + /** + * Clean versions. For example `v1.3.0` → `1.3.0`. + * @default true + */ + clean?: boolean; + } +} diff --git a/types/to-semver/to-semver-tests.ts b/types/to-semver/to-semver-tests.ts new file mode 100644 index 0000000000..5599c594d1 --- /dev/null +++ b/types/to-semver/to-semver-tests.ts @@ -0,0 +1,3 @@ +import toSemver = require('to-semver'); + +toSemver(['v1.3.16', 'v1.7.0', 'test', 'v1.6.9']); // $ExpectType string[] diff --git a/types/to-semver/tsconfig.json b/types/to-semver/tsconfig.json new file mode 100644 index 0000000000..0584eb2068 --- /dev/null +++ b/types/to-semver/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", + "to-semver-tests.ts" + ] +} diff --git a/types/to-semver/tslint.json b/types/to-semver/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/to-semver/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }