From 45f9d409646e5dba28e28e0f9a8848672775aa8d Mon Sep 17 00:00:00 2001 From: Evangelos Zotos Date: Sun, 20 Jan 2019 02:57:48 +0100 Subject: [PATCH] Adds type definitions for the npm module "is-function" --- types/is-function/index.d.ts | 8 ++++++++ types/is-function/is-function-tests.ts | 9 +++++++++ types/is-function/tsconfig.json | 16 ++++++++++++++++ types/is-function/tslint.json | 1 + 4 files changed, 34 insertions(+) create mode 100644 types/is-function/index.d.ts create mode 100644 types/is-function/is-function-tests.ts create mode 100644 types/is-function/tsconfig.json create mode 100644 types/is-function/tslint.json diff --git a/types/is-function/index.d.ts b/types/is-function/index.d.ts new file mode 100644 index 0000000000..96a13f0b34 --- /dev/null +++ b/types/is-function/index.d.ts @@ -0,0 +1,8 @@ +// Type definitions for is-function 1.0 +// Project: https://github.com/grncdr/js-is-function +// Definitions by: Evangelos Zotos +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare function isFunction(fn: any): boolean; +declare namespace isFunction {} +export = isFunction; diff --git a/types/is-function/is-function-tests.ts b/types/is-function/is-function-tests.ts new file mode 100644 index 0000000000..a4f4215875 --- /dev/null +++ b/types/is-function/is-function-tests.ts @@ -0,0 +1,9 @@ +import * as isFunction from "is-function"; + +const a: boolean = isFunction("string"); +const b: boolean = isFunction(true); +const c: boolean = isFunction((a: number) => a * a); +const d: boolean = isFunction({ type: "number" }); +const e: boolean = isFunction(() => { + return "I am anounymous!"; +}); diff --git a/types/is-function/tsconfig.json b/types/is-function/tsconfig.json new file mode 100644 index 0000000000..ab7efbe2c7 --- /dev/null +++ b/types/is-function/tsconfig.json @@ -0,0 +1,16 @@ +{ + "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-function-tests.ts"] +} diff --git a/types/is-function/tslint.json b/types/is-function/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/is-function/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }