Add types for semver-utils (#41734)

This commit is contained in:
Jamie Magee
2020-01-20 18:52:31 -05:00
committed by Eli Barzilay
parent b5a1267b5e
commit 78c13f520c
4 changed files with 54 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
// Type definitions for semver-utils 1.1
// Project: https://git.coolaj86.com/coolaj86/semver-utils.js
// Definitions by: Jamie Magee <https://github.com/JamieMagee>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export interface SemVer {
semver?: string;
version?: string;
major?: string;
minor?: string;
patch?: string;
release?: string;
build?: string;
operator?: string;
}
export function parse(version: string): SemVer;
export function stringify(version: SemVer): string;
export function parseRange(range: string): SemVer[];
export function stringifyRange(version: SemVer[]): string;
+10
View File
@@ -0,0 +1,10 @@
import { stringify, SemVer, parse } from 'semver-utils';
const version: SemVer = {
major: '1',
minor: '0',
patch: '0',
};
stringify(version); // $ExpectType string
parse('1.0.0'); // $ExpectType SemVer
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"semver-utils-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }