diff --git a/types/spected/index.d.ts b/types/spected/index.d.ts new file mode 100644 index 0000000000..13b46ddd22 --- /dev/null +++ b/types/spected/index.d.ts @@ -0,0 +1,30 @@ +// Type definitions for spected 0.26 +// Project: https://github.com/25th-floor/spected +// Definitions by: Benjamin Makus +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +declare var spected: Spected; + +export type Spected = (spec: Spec, input: any) => Result; + +export type Predicate = (value: any, inputs: any) => boolean; + +export type ErrorMsg = + | string + | ((value: any, field: string) => string); + +export interface Spec { + [key: string]: SpecValue; +} + +export type SpecValue = + | ReadonlyArray<[Predicate, ErrorMsg]> + | ((value: any) => any) + | Spec; + +export interface Result { + [key: string]: true | string[] | Result; +} + +export default spected; diff --git a/types/spected/tsconfig.json b/types/spected/tsconfig.json new file mode 100644 index 0000000000..ecc22c8314 --- /dev/null +++ b/types/spected/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts" + ] +} diff --git a/types/spected/tslint.json b/types/spected/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/spected/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }