mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-22 11:57:33 +08:00
[file-exists] add typings (#18926)
This commit is contained in:
committed by
Mohamed Hegazy
parent
f18efced61
commit
74cfcd8638
15
types/file-exists/file-exists-tests.ts
Normal file
15
types/file-exists/file-exists-tests.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import fileExists = require('file-exists');
|
||||
|
||||
fileExists('/index.html', (err, exists) => {
|
||||
err; // $ExpectType Error | null
|
||||
exists; // $ExpectType boolean
|
||||
});
|
||||
|
||||
fileExists('/index.html', {root: ''}, (err, exists) => {
|
||||
err; // $ExpectType Error | null
|
||||
exists; // $ExpectType boolean
|
||||
});
|
||||
|
||||
// $ExpectType boolean
|
||||
fileExists.sync('/index.html');
|
||||
fileExists.sync('/index.html', {root: ''});
|
||||
17
types/file-exists/index.d.ts
vendored
Normal file
17
types/file-exists/index.d.ts
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
// Type definitions for file-exists 4.0
|
||||
// Project: https://github.com/scottcorgan/file-exists
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = fileExists;
|
||||
|
||||
declare function fileExists(filepath: string, callback?: (err: Error | null, exists: boolean) => void): void;
|
||||
declare function fileExists(filepath: string, options?: fileExists.Options, callback?: (err: Error | null, exists: boolean) => void): void;
|
||||
|
||||
declare namespace fileExists {
|
||||
function sync(filepath: string, options?: Options): boolean;
|
||||
|
||||
interface Options {
|
||||
root?: string;
|
||||
}
|
||||
}
|
||||
22
types/file-exists/tsconfig.json
Normal file
22
types/file-exists/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",
|
||||
"file-exists-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/file-exists/tslint.json
Normal file
1
types/file-exists/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user