diff --git a/types/path-exists/index.d.ts b/types/path-exists/index.d.ts index f82d5ba870..dfd7ad2813 100644 --- a/types/path-exists/index.d.ts +++ b/types/path-exists/index.d.ts @@ -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 +// 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; + +declare namespace pathExists { + function sync(path: string): boolean; +} diff --git a/types/path-exists/path-exists-tests.ts b/types/path-exists/path-exists-tests.ts index 69aeb2ecd4..9cb79e8602 100644 --- a/types/path-exists/path-exists-tests.ts +++ b/types/path-exists/path-exists-tests.ts @@ -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"); diff --git a/types/path-exists/tsconfig.json b/types/path-exists/tsconfig.json index 8edff6556b..d6a6dcc606 100644 --- a/types/path-exists/tsconfig.json +++ b/types/path-exists/tsconfig.json @@ -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" ] -} \ No newline at end of file +} diff --git a/types/path-exists/tslint.json b/types/path-exists/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/path-exists/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/path-exists/v1/index.d.ts b/types/path-exists/v1/index.d.ts new file mode 100644 index 0000000000..ae3df252c4 --- /dev/null +++ b/types/path-exists/v1/index.d.ts @@ -0,0 +1,12 @@ +// Type definitions for path-exists 1.0 +// Project: https://github.com/sindresorhus/path-exists +// Definitions by: Shogo Iwano +// 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; diff --git a/types/path-exists/v1/path-exists-tests.ts b/types/path-exists/v1/path-exists-tests.ts new file mode 100644 index 0000000000..5c5553b5de --- /dev/null +++ b/types/path-exists/v1/path-exists-tests.ts @@ -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"); diff --git a/types/path-exists/v1/tsconfig.json b/types/path-exists/v1/tsconfig.json new file mode 100644 index 0000000000..1e8753cb6b --- /dev/null +++ b/types/path-exists/v1/tsconfig.json @@ -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" + ] +} diff --git a/types/path-exists/v1/tslint.json b/types/path-exists/v1/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/path-exists/v1/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }