Add types for path-type

This commit is contained in:
Dimitri Benin
2018-12-12 21:20:00 +01:00
parent 73a3ac3c9f
commit 3e8bfc0e7c
4 changed files with 54 additions and 0 deletions
+15
View File
@@ -0,0 +1,15 @@
// Type definitions for path-type 3.0
// Project: https://github.com/sindresorhus/path-type#readme
// Definitions by: BendingBender <https://github.com/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<boolean>;
export type PathTypeSyncFn = (path: string) => boolean;
+15
View File
@@ -0,0 +1,15 @@
import pathType = require('path-type');
// $ExpectType Promise<boolean>
pathType.file('package.json');
// $ExpectType Promise<boolean>
pathType.dir('package.json');
// $ExpectType Promise<boolean>
pathType.symlink('package.json');
// $ExpectType boolean
pathType.fileSync('package.json');
// $ExpectType boolean
pathType.dirSync('package.json');
// $ExpectType boolean
pathType.symlinkSync('package.json');
+23
View File
@@ -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"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }