mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-17 22:44:18 +08:00
[find-up] add typings (#18838)
This commit is contained in:
committed by
Mohamed Hegazy
parent
46888997b8
commit
57e1894ced
14
types/find-up/find-up-tests.ts
Normal file
14
types/find-up/find-up-tests.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import findUp = require('find-up');
|
||||
|
||||
findUp('unicorn.png').then(filepath => {
|
||||
filepath; // $ExpectType string | null
|
||||
});
|
||||
|
||||
findUp('unicorn.png', {cwd: ''});
|
||||
findUp(['rainbow.png', 'unicorn.png']);
|
||||
findUp(['rainbow.png', 'unicorn.png'], {cwd: ''});
|
||||
|
||||
findUp.sync('unicorn.png'); // $ExpectType string | null
|
||||
findUp.sync('unicorn.png', {cwd: ''});
|
||||
findUp.sync(['rainbow.png', 'unicorn.png']);
|
||||
findUp.sync(['rainbow.png', 'unicorn.png'], {cwd: ''});
|
||||
16
types/find-up/index.d.ts
vendored
Normal file
16
types/find-up/index.d.ts
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
// Type definitions for find-up 2.1
|
||||
// Project: https://github.com/sindresorhus/find-up#readme
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = findUp;
|
||||
|
||||
declare function findUp(filename: string | string[], options?: findUp.Options): Promise<string | null>;
|
||||
|
||||
declare namespace findUp {
|
||||
function sync(filename: string | string[], options?: findUp.Options): string | null;
|
||||
|
||||
interface Options {
|
||||
cwd?: string;
|
||||
}
|
||||
}
|
||||
22
types/find-up/tsconfig.json
Normal file
22
types/find-up/tsconfig.json
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"find-up-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/find-up/tslint.json
Normal file
1
types/find-up/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user