Merge pull request #31953 from benneq/master

add typings for spected
This commit is contained in:
Daniel Rosenwasser
2019-01-14 14:30:02 -08:00
committed by GitHub
3 changed files with 53 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
// Type definitions for spected 0.26
// Project: https://github.com/25th-floor/spected
// Definitions by: Benjamin Makus <https://github.com/benneq>
// 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;
+22
View File
@@ -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"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }