refactor: infer literal type if all else fails

This commit is contained in:
cha0s 2021-01-30 23:32:27 -06:00
parent ec9eb85659
commit 86a9261edd

View File

@ -1,5 +1,6 @@
import {join} from 'path'; import {join} from 'path';
import {Context} from '@avocado/behavior';
import {PropTypes, React} from '@latus/react'; import {PropTypes, React} from '@latus/react';
import { import {
Number, Number,
@ -109,8 +110,14 @@ const Literal = ({
value={null === value ? [0, 0] : value} value={null === value ? [0, 0] : value}
/> />
); );
default: case 'function':
case 'null':
case 'array':
return null; return null;
default:
return 'undefined' !== typeof value
? valueComponent(path, Context.inferTypeOf(value), {value})
: null;
} }
}; };
return ( return (