diff --git a/src/typeEvaluator/functions.ts b/src/typeEvaluator/functions.ts index 4f57833..17ea80b 100644 --- a/src/typeEvaluator/functions.ts +++ b/src/typeEvaluator/functions.ts @@ -103,6 +103,9 @@ export function handleFuncCallNode(node: FuncCallNode, scope: Scope): TypeNode { return {type: 'null'} }) } + case 'dateTime.now': { + return {type: 'string'} + } case 'global.now': { return {type: 'string'} } diff --git a/test/typeEvaluate.test.ts b/test/typeEvaluate.test.ts index 6ba926f..57ece7f 100644 --- a/test/typeEvaluate.test.ts +++ b/test/typeEvaluate.test.ts @@ -2132,7 +2132,8 @@ t.test('function: global::round', (t) => { t.test('function: global::now', (t) => { const query = `*[_type == "post"] { - "now": now() + "now": now(), + "dateTimeNow": dateTime::now() }` const ast = parse(query) const res = typeEvaluate(ast, schemas) @@ -2147,6 +2148,12 @@ t.test('function: global::now', (t) => { type: 'string', }, }, + dateTimeNow: { + type: 'objectAttribute', + value: { + type: 'string', + }, + }, }, }, })