diff --git a/types/matchdep/index.d.ts b/types/matchdep/index.d.ts new file mode 100644 index 0000000000..4496f6e977 --- /dev/null +++ b/types/matchdep/index.d.ts @@ -0,0 +1,18 @@ +// Type definitions for matchdep 2.0 +// Project: https://github.com/tkellen/js-matchdep +// Definitions by: tpluscode +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare namespace matchdep { + type FilterConfig = string | object; + type FilterFunction = (pattern: string | string[], config?: FilterConfig) => string[]; +} + +declare const matchdep: { + readonly filter: matchdep.FilterFunction + readonly filterDev: matchdep.FilterFunction + readonly filterPeer: matchdep.FilterFunction + readonly filterAll: matchdep.FilterFunction +}; + +export = matchdep; diff --git a/types/matchdep/matchdep-tests.ts b/types/matchdep/matchdep-tests.ts new file mode 100644 index 0000000000..09d25852dd --- /dev/null +++ b/types/matchdep/matchdep-tests.ts @@ -0,0 +1,9 @@ +import matchdep = require('matchdep'); + +const packageJson = {}; + +const singlePattern = matchdep.filter('mini*'); +const devDependencies = matchdep.filterDev('grunt-contrib-*', './package.json'); +const peerDependencies = matchdep.filterPeer('foo-{bar,baz}', './some-other.json'); +const all = matchdep.filterAll('*', packageJson); +const arrayPaterns = matchdep.filterAll(['*', '!grunt']); diff --git a/types/matchdep/tsconfig.json b/types/matchdep/tsconfig.json new file mode 100644 index 0000000000..881ebbdef6 --- /dev/null +++ b/types/matchdep/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "matchdep-tests.ts" + ] +} diff --git a/types/matchdep/tslint.json b/types/matchdep/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/matchdep/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }