Merge pull request #31622 from BendingBender/isexe

[isexe] Add types
This commit is contained in:
Wesley Wigham
2018-12-24 21:24:14 -08:00
committed by GitHub
4 changed files with 72 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
// Type definitions for isexe 2.0
// Project: https://github.com/isaacs/isexe#readme
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
export = isExe;
declare function isExe(path: string, options?: isExe.Options): Promise<boolean>;
declare function isExe(
path: string,
callback: (error: NodeJS.ErrnoException | undefined, isExe: boolean) => void
): void;
declare function isExe(
path: string,
options: isExe.Options,
callback: (error: NodeJS.ErrnoException | undefined, isExe: boolean) => void
): void;
declare namespace isExe {
function sync(path: string, options?: Options): boolean;
interface Options {
ignoreErrors?: boolean;
uid?: number;
gid?: number;
pathExt?: string;
}
}
+18
View File
@@ -0,0 +1,18 @@
import isexe = require('isexe');
isexe('some-file-name'); // $ExpectType Promise<boolean>
isexe('some-file-name', { ignoreErrors: true }); // $ExpectType Promise<boolean>
isexe('some-file-name', { uid: 123 }); // $ExpectType Promise<boolean>
isexe('some-file-name', { gid: 123 }); // $ExpectType Promise<boolean>
isexe('some-file-name', { pathExt: 'exe;bat' }); // $ExpectType Promise<boolean>
isexe('some-file-name', (err, isExe) => {
err; // $ExpectType ErrnoException | undefined
isExe; // $ExpectType boolean
});
isexe('some-file-name', { ignoreErrors: true }, (err, isExe) => {
err; // $ExpectType ErrnoException | undefined
isExe; // $ExpectType boolean
});
isexe.sync('some-file-name'); // $ExpectType boolean
isexe.sync('some-file-name', { ignoreErrors: true }); // $ExpectType boolean
+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",
"isexe-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }