From 62fc10c34934d0b53ea4ce01045806de09522ee6 Mon Sep 17 00:00:00 2001 From: Julian Hundeloh Date: Tue, 2 Apr 2019 14:00:20 +0200 Subject: [PATCH] fix: predicate is a function and not a string --- types/js-yaml/index.d.ts | 4 ++-- types/js-yaml/js-yaml-tests.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/types/js-yaml/index.d.ts b/types/js-yaml/index.d.ts index b59741e74e..24a8a7f278 100644 --- a/types/js-yaml/index.d.ts +++ b/types/js-yaml/index.d.ts @@ -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; }; diff --git a/types/js-yaml/js-yaml-tests.ts b/types/js-yaml/js-yaml-tests.ts index 304da7731d..44cf825205 100644 --- a/types/js-yaml/js-yaml-tests.ts +++ b/types/js-yaml/js-yaml-tests.ts @@ -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;