From 7c8b923faac7b2df41ef407988d487a302849fcf Mon Sep 17 00:00:00 2001 From: Benjamin Makus Date: Tue, 8 Jan 2019 03:09:00 +0100 Subject: [PATCH] add typings for spected --- types/spected/index.d.ts | 26 +++++++++++++++----------- types/spected/spected-tests.ts | 0 types/spected/tsconfig.json | 4 ++-- 3 files changed, 17 insertions(+), 13 deletions(-) delete mode 100644 types/spected/spected-tests.ts diff --git a/types/spected/index.d.ts b/types/spected/index.d.ts index 3c97ed98b4..13b46ddd22 100644 --- a/types/spected/index.d.ts +++ b/types/spected/index.d.ts @@ -1,26 +1,30 @@ -// Type definitions for yup 0.26 +// Type definitions for spected 0.26 // Project: https://github.com/25th-floor/spected -// Definitions by: Benjamin Makus , +// Definitions by: Benjamin Makus // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 3.2 +// TypeScript Version: 2.1 declare var spected: Spected; -export type Spected = (spec: Spec, input: any) => Result +export type Spected = (spec: Spec, input: any) => Result; -export type Predicate = (value: any, inputs: any) => boolean +export type Predicate = (value: any, inputs: any) => boolean; export type ErrorMsg = | string - | ((value: any, field: string) => string) + | ((value: any, field: string) => string); -export type Spec = {[key: string]: SpecValue } +export interface Spec { + [key: string]: SpecValue; +} -export type SpecValue = +export type SpecValue = | ReadonlyArray<[Predicate, ErrorMsg]> | ((value: any) => any) - | Spec + | Spec; -export type Result = {[key: string]: true | Array | Result} +export interface Result { + [key: string]: true | string[] | Result; +} -export default spected; \ No newline at end of file +export default spected; diff --git a/types/spected/spected-tests.ts b/types/spected/spected-tests.ts deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/types/spected/tsconfig.json b/types/spected/tsconfig.json index 637a75fb12..ecc22c8314 100644 --- a/types/spected/tsconfig.json +++ b/types/spected/tsconfig.json @@ -7,6 +7,7 @@ "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, + "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ "../" @@ -16,7 +17,6 @@ "forceConsistentCasingInFileNames": true }, "files": [ - "index.d.ts", - "spected-tests.ts" + "index.d.ts" ] }