mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-17 12:16:38 +08:00
feat(read-pkg-up): add types
This commit is contained in:
31
types/read-pkg-up/index.d.ts
vendored
Normal file
31
types/read-pkg-up/index.d.ts
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
// Type definitions for read-pkg-up 2.0
|
||||
// Project: https://github.com/sindresorhus/read-pkg-up
|
||||
// Definitions by: Louis Orleans <https://github.com/dudeofawesome>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace ReadPkgUp {
|
||||
function sync(options?: Options): Package;
|
||||
|
||||
interface Options {
|
||||
/**
|
||||
* Directory to start looking for a package.json file.
|
||||
*
|
||||
* @default 'process.cwd()'
|
||||
*/
|
||||
cwd?: string;
|
||||
/**
|
||||
* [Normalize](https://github.com/npm/normalize-package-data#what-normalization-currently-entails) the package data.
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
normalize?: boolean;
|
||||
}
|
||||
|
||||
interface Package {
|
||||
[key: string]: any;
|
||||
}
|
||||
}
|
||||
|
||||
declare function ReadPkgUp(options?: ReadPkgUp.Options): Promise<ReadPkgUp.Package>;
|
||||
|
||||
export = ReadPkgUp;
|
||||
4
types/read-pkg-up/read-pkg-up-tests.ts
Normal file
4
types/read-pkg-up/read-pkg-up-tests.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
import * as ReadPkgUp from 'read-pkg-up';
|
||||
|
||||
ReadPkgUp({cwd: '.', normalize: false}).then(pkg => typeof pkg === 'object');
|
||||
typeof ReadPkgUp.sync({cwd: '.', normalize: false}) === 'object';
|
||||
22
types/read-pkg-up/tsconfig.json
Normal file
22
types/read-pkg-up/tsconfig.json
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"read-pkg-up-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/read-pkg-up/tslint.json
Normal file
1
types/read-pkg-up/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user