feat(read-pkg-up): add types

This commit is contained in:
Louis Orleans
2017-09-19 14:23:12 -07:00
parent 6dec965823
commit 2a9da2fbf5
4 changed files with 58 additions and 0 deletions

31
types/read-pkg-up/index.d.ts vendored Normal file
View 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;

View 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';

View 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"
]
}

View File

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