[to-semver] Add types

This commit is contained in:
Dimitri Benin
2019-01-16 00:44:11 +01:00
parent e155ce25dc
commit e21660afaa
4 changed files with 53 additions and 0 deletions

26
types/to-semver/index.d.ts vendored Normal file
View File

@@ -0,0 +1,26 @@
// Type definitions for to-semver 1.1
// Project: https://github.com/sindresorhus/to-semver#readme
// Definitions by: BendingBender <https://github.com/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;
}
}

View File

@@ -0,0 +1,3 @@
import toSemver = require('to-semver');
toSemver(['v1.3.16', 'v1.7.0', 'test', 'v1.6.9']); // $ExpectType string[]

View File

@@ -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"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }