typings for precond library added

This commit is contained in:
Oliver Schneider
2015-09-14 16:22:05 +02:00
parent 7a3ca1f0b8
commit 5ee16d32e4
3 changed files with 61 additions and 0 deletions

43
precond/precond-tests.ts Normal file
View File

@@ -0,0 +1,43 @@
/// <reference path="./precond.d.ts" />
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");

View File

@@ -0,0 +1 @@
--noImplicitAny --module commonjs

17
precond/precond.d.ts vendored Normal file
View File

@@ -0,0 +1,17 @@
// Type definitions for precond 0.2.3
// Project: https://github.com/MathieuTurcotte/node-precond
// Definitions by: Oliver Schneider <https://github.com/olsio>
// 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;
}