diff --git a/types/path-type/index.d.ts b/types/path-type/index.d.ts new file mode 100644 index 0000000000..d67856f85e --- /dev/null +++ b/types/path-type/index.d.ts @@ -0,0 +1,15 @@ +// Type definitions for path-type 3.0 +// Project: https://github.com/sindresorhus/path-type#readme +// Definitions by: BendingBender +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export const file: PathTypeFn; +export const dir: PathTypeFn; +export const symlink: PathTypeFn; + +export const fileSync: PathTypeSyncFn; +export const dirSync: PathTypeSyncFn; +export const symlinkSync: PathTypeSyncFn; + +export type PathTypeFn = (path: string) => Promise; +export type PathTypeSyncFn = (path: string) => boolean; diff --git a/types/path-type/path-type-tests.ts b/types/path-type/path-type-tests.ts new file mode 100644 index 0000000000..d070731523 --- /dev/null +++ b/types/path-type/path-type-tests.ts @@ -0,0 +1,15 @@ +import pathType = require('path-type'); + +// $ExpectType Promise +pathType.file('package.json'); +// $ExpectType Promise +pathType.dir('package.json'); +// $ExpectType Promise +pathType.symlink('package.json'); + +// $ExpectType boolean +pathType.fileSync('package.json'); +// $ExpectType boolean +pathType.dirSync('package.json'); +// $ExpectType boolean +pathType.symlinkSync('package.json'); diff --git a/types/path-type/tsconfig.json b/types/path-type/tsconfig.json new file mode 100644 index 0000000000..f2c7533a5d --- /dev/null +++ b/types/path-type/tsconfig.json @@ -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", + "path-type-tests.ts" + ] +} diff --git a/types/path-type/tslint.json b/types/path-type/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/path-type/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }