mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-21 13:27:15 +08:00
Merge pull request #18719 from BendingBender/path-exists
[path-exists] add typings for v3, add strict null checks & linting
This commit is contained in:
16
types/path-exists/index.d.ts
vendored
16
types/path-exists/index.d.ts
vendored
@@ -1,13 +1,13 @@
|
||||
// Type definitions for path-exists 1.0.0
|
||||
// Type definitions for path-exists 3.0
|
||||
// Project: https://github.com/sindresorhus/path-exists
|
||||
// Definitions by: Shogo Iwano <https://github.com/shiwano>
|
||||
// BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
|
||||
interface PathExists {
|
||||
(path: string, callback: (error: Error, exists: boolean) => void): void;
|
||||
sync(path: string): boolean;
|
||||
}
|
||||
|
||||
declare var pathExists: PathExists;
|
||||
export = pathExists;
|
||||
|
||||
declare function pathExists(path: string): Promise<boolean>;
|
||||
|
||||
declare namespace pathExists {
|
||||
function sync(path: string): boolean;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
|
||||
import pathExists = require("path-exists");
|
||||
|
||||
pathExists("test/path-exists.d.ts", (error, exists) => {
|
||||
console.log(exists);
|
||||
pathExists('foo.js').then(exists => {
|
||||
const bool: boolean = exists;
|
||||
});
|
||||
console.log(pathExists.sync("test/__path-exists.d.ts"));
|
||||
const bool: boolean = pathExists.sync("test/__path-exists.d.ts");
|
||||
|
||||
@@ -2,12 +2,11 @@
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
@@ -20,4 +19,4 @@
|
||||
"index.d.ts",
|
||||
"path-exists-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
1
types/path-exists/tslint.json
Normal file
1
types/path-exists/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
12
types/path-exists/v1/index.d.ts
vendored
Normal file
12
types/path-exists/v1/index.d.ts
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
// Type definitions for path-exists 1.0
|
||||
// Project: https://github.com/sindresorhus/path-exists
|
||||
// Definitions by: Shogo Iwano <https://github.com/shiwano>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
interface PathExists {
|
||||
(path: string, callback: (error: Error, exists: boolean) => void): void;
|
||||
sync(path: string): boolean;
|
||||
}
|
||||
|
||||
declare const pathExists: PathExists;
|
||||
export = pathExists;
|
||||
6
types/path-exists/v1/path-exists-tests.ts
Normal file
6
types/path-exists/v1/path-exists-tests.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import pathExists = require("path-exists");
|
||||
|
||||
pathExists("test/path-exists.d.ts", (error, exists) => {
|
||||
const bool: boolean = exists;
|
||||
});
|
||||
const bool: boolean = pathExists.sync("test/__path-exists.d.ts");
|
||||
25
types/path-exists/v1/tsconfig.json
Normal file
25
types/path-exists/v1/tsconfig.json
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../../",
|
||||
"typeRoots": [
|
||||
"../../"
|
||||
],
|
||||
"paths": {
|
||||
"path-exists": ["path-exists/v1"]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"path-exists-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/path-exists/v1/tslint.json
Normal file
1
types/path-exists/v1/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user