Merge pull request #32221 from BendingBender/junk

[junk] Add types
This commit is contained in:
Daniel Rosenwasser
2019-01-16 10:39:33 -08:00
committed by GitHub
4 changed files with 53 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
// Type definitions for junk 2.1
// Project: https://github.com/sindresorhus/junk#readme
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/**
* Returns `true` if `filename` matches a junk file.
*/
export function is(filename: string): boolean;
/**
* Returns `true` if `filename` doesn't match a junk file.
*/
export function not(filename: string): boolean;
/**
* Regex used for matching.
*/
export const regex: RegExp;
+12
View File
@@ -0,0 +1,12 @@
/// <reference types="node" />
import fs = require('fs');
import * as junk from 'junk';
junk.is('foo'); // $ExpectType boolean
junk.not('foo'); // $ExpectType boolean
junk.regex; // $ExpectType RegExp
fs.readdir('some/path', (err, files) => {
files.filter(junk.not);
});
+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",
"junk-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }