mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-06-05 20:02:05 +08:00
Merge pull request #21448 from mrmlnc/bash_glob
[bash-glob] Add typings for "bash-glob" package
This commit is contained in:
21
types/bash-glob/bash-glob-tests.ts
Normal file
21
types/bash-glob/bash-glob-tests.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import bashGlob = require('bash-glob');
|
||||
|
||||
bashGlob('pattern', (err, files) => {});
|
||||
bashGlob(['pattern'], (err, files) => {});
|
||||
bashGlob(['pattern'], {}, (err, files) => {});
|
||||
bashGlob(['pattern'], { cwd: 'cwd' }, (err, files) => { });
|
||||
|
||||
bashGlob.on('match', (match, cwd) => {});
|
||||
bashGlob.on('files', (files, cwd) => {});
|
||||
bashGlob.on('end', (files) => {});
|
||||
|
||||
bashGlob.each('pattern', (err, files) => {});
|
||||
bashGlob.each(['pattern'], (err, files) => {});
|
||||
bashGlob.each(['pattern'], {}, (err, files) => {});
|
||||
bashGlob.each(['pattern'], { cwd: 'cwd' }, (err, files) => {});
|
||||
|
||||
// $ExpectType string[]
|
||||
bashGlob.sync('pattern');
|
||||
bashGlob.sync(['pattern']);
|
||||
bashGlob.sync(['pattern'], {});
|
||||
bashGlob.sync(['pattern'], { cwd: 'cwd' });
|
||||
36
types/bash-glob/index.d.ts
vendored
Normal file
36
types/bash-glob/index.d.ts
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
// Type definitions for bash-glob 2.0
|
||||
// Project: https://github.com/micromatch/bash-glob
|
||||
// Definitions by: mrmlnc <https://github.com/mrmlnc>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
type Patterns = string | string[];
|
||||
type Callback = (err: Error, files: string[]) => void;
|
||||
|
||||
declare function bashGlob(pattern: Patterns, callback: Callback): void;
|
||||
declare function bashGlob(pattern: Patterns, options: bashGlob.Options, callback: Callback): void;
|
||||
|
||||
declare namespace bashGlob {
|
||||
interface Options {
|
||||
cwd?: string;
|
||||
dot?: boolean;
|
||||
dotglob?: boolean;
|
||||
extglob?: boolean;
|
||||
failglob?: boolean;
|
||||
globstar?: boolean;
|
||||
nocase?: boolean;
|
||||
nocaseglob?: boolean;
|
||||
nullglob?: boolean;
|
||||
}
|
||||
|
||||
function on(event: 'match' | 'files', callback: (files: string, cwd: string) => void): void;
|
||||
function on(event: 'end', callback: (files: string) => void): void;
|
||||
|
||||
function each(patterns: Patterns, callback: Callback): void;
|
||||
function each(patterns: Patterns, options: Options, callback: Callback): void;
|
||||
|
||||
function promise(patterns: Patterns, options?: Options): Promise<string[]>;
|
||||
|
||||
function sync(patterns: Patterns, options?: Options): string[];
|
||||
}
|
||||
|
||||
export = bashGlob;
|
||||
23
types/bash-glob/tsconfig.json
Normal file
23
types/bash-glob/tsconfig.json
Normal 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",
|
||||
"bash-glob-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/bash-glob/tslint.json
Normal file
1
types/bash-glob/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user