fix: predicate is a function and not a string

This commit is contained in:
Julian Hundeloh
2019-04-02 14:00:20 +02:00
parent 93ed5c2843
commit 62fc10c349
2 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -15,7 +15,7 @@ export class Type {
resolve(data: any): boolean;
construct(data: any): any;
instanceOf: object | null;
predicate: string | null;
predicate: (data:object) => boolean | null;
represent: ((data: object) => any) | { [x: string]: (data: object) => any; } | null;
defaultStyle: string | null;
styleAliases: { [x: string]: any; };
@@ -82,7 +82,7 @@ export interface TypeConstructorOptions {
resolve?: (data: any) => boolean;
construct?: (data: any) => any;
instanceOf?: object;
predicate?: string;
predicate?: (data:object) => boolean;
represent?: ((data: object) => any) | { [x: string]: (data: object) => any };
defaultStyle?: string;
styleAliases?: { [x: string]: any; };
+2 -2
View File
@@ -23,7 +23,7 @@ const typeConstructorOptions: TypeConstructorOptions = {
resolve: fn,
construct: fn,
instanceOf: obj,
predicate: str,
predicate: (obj) => true,
represent: fn,
defaultStyle: str,
styleAliases: map
@@ -104,7 +104,7 @@ type.resolve;
type.construct;
// $ExpectType object | null
type.instanceOf;
// $ExpectType string | null
// $ExpectType (data:object) => boolean | null
type.predicate;
// $ExpectType ((data: object) => any) | { [x: string]: (data: object) => any; } | null
type.represent;