From 86a9261edd7089030a7a4fa65ed9ef5d5f9f1f3d Mon Sep 17 00:00:00 2001 From: cha0s Date: Sat, 30 Jan 2021 23:32:27 -0600 Subject: [PATCH] refactor: infer literal type if all else fails --- packages/entity/src/behavior-components/literal.jsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/entity/src/behavior-components/literal.jsx b/packages/entity/src/behavior-components/literal.jsx index 11342ed..c49b50a 100644 --- a/packages/entity/src/behavior-components/literal.jsx +++ b/packages/entity/src/behavior-components/literal.jsx @@ -1,5 +1,6 @@ import {join} from 'path'; +import {Context} from '@avocado/behavior'; import {PropTypes, React} from '@latus/react'; import { Number, @@ -109,8 +110,14 @@ const Literal = ({ value={null === value ? [0, 0] : value} /> ); - default: + case 'function': + case 'null': + case 'array': return null; + default: + return 'undefined' !== typeof value + ? valueComponent(path, Context.inferTypeOf(value), {value}) + : null; } }; return (