[git-semver-tags] Added type definitions for git-semver-tags (#41440)

This commit is contained in:
Kwok Chi Leong 2020-01-08 07:51:12 +08:00 committed by Armando Aguirre
parent e576ea16e4
commit 2d34dc1046
4 changed files with 78 additions and 0 deletions

View File

@ -0,0 +1,21 @@
"use strict";
import gitSemverTags from "git-semver-tags";
declare const callback: gitSemverTags.Callback;
declare const options: gitSemverTags.Options;
// $ExpectType void
gitSemverTags(callback);
// $ExpectType void
gitSemverTags(options, callback);
// $ExpectError
gitSemverTags();
// $ExpectError
gitSemverTags(options);
// $ExpectError
gitSemverTags(callback, options);

32
types/git-semver-tags/index.d.ts vendored Normal file
View File

@ -0,0 +1,32 @@
// Type definitions for git-semver-tags 3.0
// Project: https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/git-semver-tags#readme
// Definitions by: Jason Kwok <https://github.com/JasonHK>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.7
declare function gitSemverTags(callback: gitSemverTags.Callback): void;
declare function gitSemverTags(options: gitSemverTags.Options, callback: gitSemverTags.Callback): void;
declare namespace gitSemverTags {
type Callback = (error: any, tags: string[]) => void;
interface Options {
/**
* Extract lerna style tags (`foo-package@2.0.0`) from the git history, rather
* than `v1.0.0` format.
*/
lernaTags?: boolean;
/**
* What package should lerna style tags be listed for, e.g., `foo-package`.
*/
package?: string;
/**
* Specify a prefix for the git tag to be ignored from the semver checks.
*/
tagPrefix?: string;
}
}
export = gitSemverTags;

View File

@ -0,0 +1,24 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"esModuleInterop": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"git-semver-tags-tests.ts"
]
}

View File

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