Comparing version 1.11.1 to 1.12.0
{ | ||
"name": "groq-js", | ||
"version": "1.11.1", | ||
"version": "1.12.0", | ||
"keywords": [ | ||
@@ -5,0 +5,0 @@ "sanity", |
@@ -5,3 +5,3 @@ /* eslint-disable max-statements */ | ||
import {walk} from './typeEvaluate' | ||
import {mapConcrete} from './typeHelpers' | ||
import {mapConcrete, nullUnion} from './typeHelpers' | ||
import type {NullTypeNode, TypeNode} from './types' | ||
@@ -152,2 +152,30 @@ | ||
case 'global.dateTime': { | ||
const arg = walk({node: node.args[0], scope}) | ||
return mapConcrete(arg, scope, (arg) => { | ||
if (arg.type === 'string') { | ||
return nullUnion({type: 'string'}) // we don't know wether the string is a valid date or not, so we return a [null, string]-union | ||
} | ||
return {type: 'null'} satisfies NullTypeNode | ||
}) | ||
} | ||
case 'global.length': { | ||
const arg = walk({node: node.args[0], scope}) | ||
return mapConcrete(arg, scope, (arg) => { | ||
if (arg.type === 'array') { | ||
return {type: 'number'} | ||
} | ||
if (arg.type === 'string') { | ||
return {type: 'number'} | ||
} | ||
return {type: 'null'} | ||
}) | ||
} | ||
case 'global.references': { | ||
@@ -154,0 +182,0 @@ return {type: 'boolean'} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
983821
13423