Add types for is-obj and is-regexp (#30571)

This commit is contained in:
Emily Marigold Klassen
2018-11-16 16:06:58 -08:00
committed by Pranav Senthilnathan
parent 4d24ec8a7e
commit 502207021b
8 changed files with 86 additions and 0 deletions
+9
View File
@@ -0,0 +1,9 @@
// Type definitions for is-obj 1.0
// Project: https://github.com/sindresorhus/is-obj#readme
// Definitions by: Emily Marigold Klassen <https://github.com/forivall>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
export = isObj;
declare function isObj(x: any): x is object;
+10
View File
@@ -0,0 +1,10 @@
import isObj = require('is-obj');
isObj({foo: 'bar'});
// => true
isObj([1, 2, 3]);
// => true
isObj('foo');
// => false
+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",
"is-obj-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+9
View File
@@ -0,0 +1,9 @@
// Type definitions for is-regexp 2.0
// Project: https://github.com/sindresorhus/is-regexp#readme
// Definitions by: Emily Marigold Klassen <https://github.com/forivall>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
export = isRegexp;
declare function isRegexp(input: any): input is RegExp;
+10
View File
@@ -0,0 +1,10 @@
import isRegexp = require('is-regexp');
isRegexp('unicorn');
// => false
isRegexp(/unicorn/);
// => true
isRegexp(new RegExp('unicorn'));
// => true
+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",
"is-regexp-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }