mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-03-30 17:04:20 +08:00
Add types for pkg-dir package (#22601)
This commit is contained in:
12
types/pkg-dir/index.d.ts
vendored
Normal file
12
types/pkg-dir/index.d.ts
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
// Type definitions for pkg-dir 2.0
|
||||
// Project: https://github.com/sindresorhus/pkg-dir#readme
|
||||
// Definitions by: NK-WEB-Git <https://github.com/NK-WEB-Git>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = pkgDir;
|
||||
|
||||
declare function pkgDir(cwd?: string): Promise<string | null>;
|
||||
|
||||
declare namespace pkgDir {
|
||||
function sync(cwd?: string): string | null;
|
||||
}
|
||||
11
types/pkg-dir/pkg-dir-tests.ts
Normal file
11
types/pkg-dir/pkg-dir-tests.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import pkgDir = require('pkg-dir');
|
||||
|
||||
pkgDir('/Users/project/pkg-dir').then(rootDir => {
|
||||
rootDir; // $ExpectType string | null
|
||||
});
|
||||
|
||||
pkgDir().then(rootDir => {
|
||||
rootDir;
|
||||
});
|
||||
|
||||
pkgDir.sync('/Users/project/pkg-dir'); // $ExpectType string | null
|
||||
23
types/pkg-dir/tsconfig.json
Normal file
23
types/pkg-dir/tsconfig.json
Normal 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",
|
||||
"pkg-dir-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/pkg-dir/tslint.json
Normal file
1
types/pkg-dir/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user