Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typegen query resolves to Array<never> when using date filters #8255

Open
sebbean opened this issue Jan 13, 2025 · 0 comments
Open

Typegen query resolves to Array<never> when using date filters #8255

sebbean opened this issue Jan 13, 2025 · 0 comments

Comments

@sebbean
Copy link

sebbean commented Jan 13, 2025

Calling this groq query:

export const sourcesByRecordingDateQuery = defineQuery(`
  *[_type == "streem.source" && defined(recording) && defined(recording->recordingDate) 
    && !defined(parentSource)
    && dateTime(array::join([$filterDate,"00:00:00.00Z"],"T")) < dateTime(recording->recordingDate)
    && dateTime(recording->recordingDate) < dateTime(array::join([$filterDate,"23:59:59.99Z"],"T")) + 60 * 60 * 24
  ] | order(recording->recordingDate asc)

I'm getting this type:

When I remove these lines:

&& dateTime(array::join([$filterDate,"00:00:00.00Z"],"T")) < dateTime(recording->recordingDate)
&& dateTime(recording->recordingDate) < dateTime(array::join([$filterDate,"23:59:59.99Z"],"T")) + 60 * 60 * 24

it generates ok:

// Variable: sourcesByRecordingDateQuery
// Query: *[_type == "streem.source" && defined(recording) && defined(recording->recordingDate)     && !defined(parentSource)      ] {    ...,    "recordingDate": recording->recordingDate  }   | order(recording->recordingDate asc)
export type SourcesByRecordingDateQueryResult = Array<{
  _id: string;
  _type: "streem.source";

deps:

  "dependencies": {
    "@sanity/client": "^6.24.1",
    "@sanity/color-input": "^4.0.3",
    "@sanity/import": "^3.37.9",
    "groq": "^3.68.3",
    "sanity": "^3.68.3",
    "styled-components": "^6.1"
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant