mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-12 04:50:18 +00:00
Merge pull request #17566 from douglasduteil/feat-globby-add-typings-for-globby
feat(globby): add typings for `globby`
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import { IOptions } from 'glob';
|
||||
|
||||
import * as globby from "globby";
|
||||
|
||||
(async () => {
|
||||
let result: string[];
|
||||
result = await globby('*.tmp');
|
||||
result = await globby(['a.tmp', '*.tmp', '!{c,d,e}.tmp']);
|
||||
|
||||
result = globby.sync('*.tmp');
|
||||
result = globby.sync(['a.tmp', '*.tmp', '!{c,d,e}.tmp']);
|
||||
|
||||
result = await globby('*.tmp', Object.freeze({ignore: Object.freeze([])}));
|
||||
result = globby.sync('*.tmp', Object.freeze({ignore: Object.freeze([])}));
|
||||
})();
|
||||
|
||||
const tasks: Array<{
|
||||
pattern: string,
|
||||
options: IOptions
|
||||
}> = globby.generateGlobTasks(['*.tmp', '!b.tmp'], {ignore: ['c.tmp']});
|
||||
|
||||
console.log(globby.hasMagic('**') === true);
|
||||
console.log(globby.hasMagic(['**', 'path1', 'path2']) === true);
|
||||
console.log(globby.hasMagic(['path1', 'path2']) === false);
|
||||
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
// Type definitions for globby 0.6
|
||||
// Project: https://github.com/sindresorhus/globby#readme
|
||||
// Definitions by: Douglas Duteil <https://github.com/douglasduteil>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import { IOptions } from 'glob';
|
||||
|
||||
declare function globby(patterns: string | string[], options?: IOptions): Promise<string[]>;
|
||||
|
||||
declare namespace globby {
|
||||
function sync(patterns: string | string[], options?: IOptions): string[];
|
||||
function generateGlobTasks(patterns: string | string[], options?: IOptions): Array<{pattern: string, options: IOptions}>;
|
||||
function hasMagic(patterns: string | string[], options?: IOptions): boolean;
|
||||
}
|
||||
|
||||
export = globby;
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"globby-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user