[defined] add typings (#18910)

This commit is contained in:
Dimitri Benin
2017-08-14 10:09:22 -07:00
committed by Mohamed Hegazy
parent 3484077f01
commit 76ef71bda5
4 changed files with 39 additions and 0 deletions
+7
View File
@@ -0,0 +1,7 @@
import defined = require('defined');
const opts = { x: undefined, y : false, w : 4 };
// $ExpectType number | boolean | undefined
defined<boolean | number | undefined>(opts.x, opts.y, opts.w, 100);
// $ExpectType any
defined(opts.x, opts.y, opts.w, 100);
+9
View File
@@ -0,0 +1,9 @@
// Type definitions for defined 1.0
// Project: https://github.com/substack/defined
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = defined;
declare function defined<T>(...args: T[]): T;
declare function defined(...args: any[]): any;
+22
View File
@@ -0,0 +1,22 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"defined-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }