feat: Add is‑regex v1.0 (#45252)

This commit is contained in:
ExE Boss 2020-06-10 17:17:21 +02:00 committed by GitHub
parent 8d8b587aae
commit 16ea51cd4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 38 additions and 0 deletions

11
types/is-regex/index.d.ts vendored Normal file
View File

@ -0,0 +1,11 @@
// Type definitions for is-regex 1.0
// Project: https://github.com/ljharb/is-regex
// Definitions by: Jordan Harband <https://github.com/ljharb>
// ExE Boss <https://github.com/ExE-Boss>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/**
* Returns whether the value is a valid `RegExp` object with the `[[RegExpMatcher]]` internal slot.
*/
declare function isRegex(value: any): value is RegExp;
export = isRegex;

View File

@ -0,0 +1,7 @@
import isRegExp = require('is-regex');
declare var any: unknown;
if (isRegExp(any)) {
any; // $ExpectType RegExp
}

View File

@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": ["ES2015"],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": ["../"],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"is-regex-tests.ts",
"index.d.ts"
]
}

View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }