From 2ff6f71060bbad6d646bcda170f98a7d0ef40654 Mon Sep 17 00:00:00 2001 From: francesco Date: Wed, 5 May 2021 12:22:27 +0200 Subject: [PATCH] Small builders.ts types fix --- example/src/SampleApp/schemas/test_schema.tsx | 13 +++++-------- src/models/builders.ts | 13 ++++++++++--- src/models/models.ts | 2 +- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/example/src/SampleApp/schemas/test_schema.tsx b/example/src/SampleApp/schemas/test_schema.tsx index cfda8d0..8c048d8 100644 --- a/example/src/SampleApp/schemas/test_schema.tsx +++ b/example/src/SampleApp/schemas/test_schema.tsx @@ -52,16 +52,13 @@ export const testEntitySchema = buildSchema({ status, context }) => { - console.log("custom onPreSave", collectionPath, id); - - getNavigationFrom({ + return getNavigationFrom({ path: `${collectionPath}/${id}`, context - }).then((result) => console.log("getNavigationFrom", result)); - - if (!values.empty_string) values.empty_string = ""; - - return values; + }).then((navigation) => { + console.log("navigation", navigation); + return values; + }); }, properties: { actions: { diff --git a/src/models/builders.ts b/src/models/builders.ts index 1f67df1..b9501e4 100644 --- a/src/models/builders.ts +++ b/src/models/builders.ts @@ -3,6 +3,7 @@ import { EntitySchema, EntityValues, EnumValueConfig, + Properties, PropertiesOrBuilder, Property, PropertyOrBuilder @@ -73,12 +74,18 @@ export function buildProperty( * same properties * @param properties */ -export function buildProperties, Key extends string>( - properties: PropertiesOrBuilder -): PropertiesOrBuilder { +export function buildProperties( + properties: Properties +): Properties { return properties; } +export function buildPropertiesOrBuilder, Key extends string>( + propertiesOrBuilder: PropertiesOrBuilder +): PropertiesOrBuilder { + return propertiesOrBuilder; +} + export function buildEnumValueConfig( enumValueConfig: EnumValueConfig ): EnumValueConfig { diff --git a/src/models/models.ts b/src/models/models.ts index dd6cdd6..3e90b71 100644 --- a/src/models/models.ts +++ b/src/models/models.ts @@ -491,7 +491,7 @@ export type EnumValueConfig = { /** * Record of properties of an entity or a map property */ -export type Properties = Record>; +export type Properties = Record>; export type PropertyBuilderProps = EntitySchema, Key extends string = Extract> = {