Merge pull request #24657 from jewbre/feature/types-for-escape-regexp

Types for escape-regexp 0.0
This commit is contained in:
Paul van Brenk
2018-04-03 12:35:16 -07:00
committed by GitHub
4 changed files with 55 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
import escapeRegExp = require('escape-regexp');
// $ExpectType string
escapeRegExp('aaa');
// $ExpectError
escapeRegExp();
// $ExpectError
escapeRegExp({});
// $ExpectError
escapeRegExp(1);
// $ExpectError
escapeRegExp([]);
// $ExpectError
escapeRegExp(null);
// $ExpectError
escapeRegExp(undefined);

9
types/escape-regexp/index.d.ts vendored Normal file
View File

@@ -0,0 +1,9 @@
// Type definitions for escape-regexp 0.0
// Project: https://www.npmjs.com/package/escape-regexp
// Definitions by: Vilim Stubičan <https://github.com/jewbre>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.4
declare function escapeRegExp(str: string): string;
export = escapeRegExp;

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",
"escape-regexp-tests.ts"
]
}

View File

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