From 5cf2c489846b4794351ebc96b4fb7217e828602e Mon Sep 17 00:00:00 2001 From: mattywong Date: Tue, 22 Dec 2020 21:06:08 +0800 Subject: [PATCH] fix(types): reach and getIn make last 2 arguments optional (#1194) Co-authored-by: Matthew Wong --- src/util/reach.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util/reach.ts b/src/util/reach.ts index 504a6b5f2..b65c76ac1 100644 --- a/src/util/reach.ts +++ b/src/util/reach.ts @@ -2,7 +2,7 @@ import { forEach } from 'property-expr'; let trim = (part: string) => part.substr(0, part.length - 1).substr(1); -export function getIn(schema: any, path: string, value: any, context = value) { +export function getIn(schema: any, path: string, value?: any, context = value) { let parent: any, lastPart: string, lastPartDebug: string; // root path: '' @@ -50,7 +50,7 @@ export function getIn(schema: any, path: string, value: any, context = value) { return { schema, parent, parentPath: lastPart! }; } -const reach = (obj: {}, path: string, value: any, context: any) => +const reach = (obj: {}, path: string, value?: any, context?: any) => getIn(obj, path, value, context).schema; export default reach;