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