Add Type to parse-package-name (#37124)

* New: Add parse package name

* add test

* .

* .

* .

* .

* .

* .

* .

* .
This commit is contained in:
Eric Wang 2019-07-26 05:18:54 +10:00 committed by Wesley Wigham
parent 419827787f
commit bf3b32a1da
4 changed files with 44 additions and 0 deletions

14
types/parse-package-name/index.d.ts vendored Normal file
View File

@ -0,0 +1,14 @@
// Type definitions for parse-package-name 0.1
// Project: https://github.com/egoist/parse-package-name
// Definitions by: Eric Wang <https://github.com/fa93hws>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = parsePackageName;
interface PackageInfo {
name: string;
path: string;
version: string;
}
declare function parsePackageName(path: string): PackageInfo;

View File

@ -0,0 +1,6 @@
import parsePackageName = require('parse-package-name');
function testType({ name, path, version }: { name: string; path: string; version: string }) {}
const result = parsePackageName('');
testType(result);

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",
"parse-package-name-tests.ts"
]
}

View File

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