mirror of
https://github.com/strapi/strapi.git
synced 2025-11-01 18:33:55 +00:00
Handle dates
This commit is contained in:
parent
870dd61c28
commit
d0168cf957
@ -11,6 +11,7 @@ const {
|
||||
isNull,
|
||||
isString,
|
||||
isNumber,
|
||||
isDate,
|
||||
isArray,
|
||||
isBoolean,
|
||||
propEq,
|
||||
@ -101,6 +102,10 @@ const toTypeLiteral = data => {
|
||||
return factory.createTupleTypeNode(data.map(item => toTypeLiteral(item)));
|
||||
}
|
||||
|
||||
if (isDate(data)) {
|
||||
return factory.createTypeReferenceNode('Date');
|
||||
}
|
||||
|
||||
if (typeof data !== 'object') {
|
||||
throw new Error(`Cannot convert to object literal. Unknown type "${typeof data}"`);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user