Merge pull request #31314 from BendingBender/dir-glob

Add types for dir-glob
This commit is contained in:
Nathan Shively-Sanders
2018-12-17 10:46:24 -08:00
committed by GitHub
4 changed files with 65 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
import dirGlob = require('dir-glob');
dirGlob('index.js').then(files => {
// ExpectType string[]
files;
});
dirGlob(['index.js', 'test.js', 'fixtures']).then(files => {
// ExpectType string[]
files;
});
dirGlob(['index.js', 'inner_folder'], { cwd: 'fixtures' });
dirGlob(['lib/**', 'fixtures'], { files: ['test', 'unicorn'] });
dirGlob(['lib/**', 'fixtures'], { extensions: ['js'] });
// ExpectType string[]
dirGlob.sync('index.js');
// ExpectType string[]
dirGlob.sync(['index.js', 'test.js', 'fixtures']);
dirGlob.sync(['index.js', 'inner_folder'], { cwd: 'fixtures' });
dirGlob.sync(['lib/**', 'fixtures'], { files: ['test', 'unicorn'] });
dirGlob.sync(['lib/**', 'fixtures'], { extensions: ['js'] });
+18
View File
@@ -0,0 +1,18 @@
// Type definitions for dir-glob 2.0
// Project: https://github.com/kevva/dir-glob#readme
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = dirGlob;
declare function dirGlob(input: string | string[], options?: dirGlob.Options): Promise<string[]>;
declare namespace dirGlob {
function sync(input: string | string[], options?: Options): string[];
interface Options {
extensions?: string[];
files?: string[];
cwd?: string;
}
}
+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",
"dir-glob-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }