From 5ee16d32e4c50575e6ef2ee9e99fedd17d2b7abc Mon Sep 17 00:00:00 2001 From: Oliver Schneider Date: Mon, 14 Sep 2015 16:22:05 +0200 Subject: [PATCH] typings for precond library added --- precond/precond-tests.ts | 43 ++++++++++++++++++++++++++++++ precond/precond-tests.ts.tscparams | 1 + precond/precond.d.ts | 17 ++++++++++++ 3 files changed, 61 insertions(+) create mode 100644 precond/precond-tests.ts create mode 100644 precond/precond-tests.ts.tscparams create mode 100644 precond/precond.d.ts diff --git a/precond/precond-tests.ts b/precond/precond-tests.ts new file mode 100644 index 0000000000..dc843e99f4 --- /dev/null +++ b/precond/precond-tests.ts @@ -0,0 +1,43 @@ +/// + +import precond = require('precond'); + +precond.checkArgument(true); +precond.checkArgument(true, "msg"); +precond.checkArgument(true, "%s %s %s", 1, "two"); + +precond.checkState(true); +precond.checkState(true, "msg"); +precond.checkState(true, "%s %s %s", 1, "two"); + +precond.checkIsDef(true); +precond.checkIsDef(true, "msg"); +precond.checkIsDef(true, "%s %s %s", 1, "two"); + +precond.checkIsDefAndNotNull(true); +precond.checkIsDefAndNotNull(true, "msg"); +precond.checkIsDefAndNotNull(true, "%s %s %s", 1, "two"); + +precond.checkIsString(true); +precond.checkIsString(true, "msg"); +precond.checkIsString(true, "%s %s %s", 1, "two"); + +precond.checkIsArray(true); +precond.checkIsArray(true, "msg"); +precond.checkIsArray(true, "%s %s %s", 1, "two"); + +precond.checkIsNumber(true); +precond.checkIsNumber(true, "msg"); +precond.checkIsNumber(true, "%s %s %s", 1, "two"); + +precond.checkIsBoolean(true); +precond.checkIsBoolean(true, "msg"); +precond.checkIsBoolean(true, "%s %s %s", 1, "two"); + +precond.checkIsFunction(true); +precond.checkIsFunction(true, "msg"); +precond.checkIsFunction(true, "%s %s %s", 1, "two"); + +precond.checkIsObject(true); +precond.checkIsObject(true, "msg"); +precond.checkIsObject(true, "%s %s %s", 1, "two"); \ No newline at end of file diff --git a/precond/precond-tests.ts.tscparams b/precond/precond-tests.ts.tscparams new file mode 100644 index 0000000000..2988d8fd66 --- /dev/null +++ b/precond/precond-tests.ts.tscparams @@ -0,0 +1 @@ +--noImplicitAny --module commonjs \ No newline at end of file diff --git a/precond/precond.d.ts b/precond/precond.d.ts new file mode 100644 index 0000000000..ef5362468a --- /dev/null +++ b/precond/precond.d.ts @@ -0,0 +1,17 @@ +// Type definitions for precond 0.2.3 +// Project: https://github.com/MathieuTurcotte/node-precond +// Definitions by: Oliver Schneider +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "precond" { + export function checkArgument(value: any, message?: string, ...formatArgs: any[]): void; + export function checkState(value: any, message?: string, ...formatArgs: any[]): void; + export function checkIsDef(value: any, message?: string, ...formatArgs: any[]): any; + export function checkIsDefAndNotNull(value: any, message?: string, ...formatArgs: any[]): any; + export function checkIsString(value: any, message?: string, ...formatArgs: any[]): any; + export function checkIsArray(value: any, message?: string, ...formatArgs: any[]): any; + export function checkIsNumber(value: any, message?: string, ...formatArgs: any[]): any; + export function checkIsBoolean(value: any, message?: string, ...formatArgs: any[]): any; + export function checkIsFunction(value: any, message?: string, ...formatArgs: any[]): any; + export function checkIsObject(value: any, message?: string, ...formatArgs: any[]): any; +} \ No newline at end of file