Add types for find-down

This commit is contained in:
Florian Keller 2019-04-01 17:32:09 +02:00
parent 0341d2d082
commit 5407df6243
No known key found for this signature in database
GPG Key ID: 5570D938BDA00C34
4 changed files with 52 additions and 0 deletions

View File

@ -0,0 +1,13 @@
import findDown = require('find-down');
findDown('unicorn.png').then(file => {
file; // $ExpectType string | null
});
findDown(['unicorn.png']).then(file => {
file; // $ExpectType string | null
});
findDown('unicorn.png', { cwd: '.' }).then(file => {
file; // $ExpectType string | null
});

15
types/find-down/index.d.ts vendored Normal file
View File

@ -0,0 +1,15 @@
// Type definitions for find-down 0.1
// Project: https://github.com/sholladay/find-down
// Definitions by: Florian Keller <https://github.com/ffflorian>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace findDown {
interface Options {
/** Directory to end with. Default: `process.cwd()` */
cwd?: string;
}
}
declare function findDown(filename: string | string[], options?: findDown.Options): Promise<string | null>;
export = findDown;

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",
"find-down-tests.ts"
]
}

View File

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