sanity-io / sanity

Sanity Studio – Rapidly configure content workspaces powered by structured content
https://www.sanity.io
MIT License
5.26k stars 426 forks source link

[Typegen error] - Undefined namespace: geo #7336

Closed cetchebarne closed 2 months ago

cetchebarne commented 2 months ago

Describe the bug

When running Typegen, I get an error when generating types for a query that uses the geo namespace. I was using Sanity 3.40 and updated to 3.53 but I'm still getting the same error. The query works fine when running it in Vision.

To Reproduce

Steps to reproduce the behavior:

1 - Use a query with geopoint: export const contactInfoQuery = groq*[_type == "contactInformation"] | order(geo::distance(location, $input)) [0] {...};

2 - This is an example schema:

export const contactInformationSchema = defineType({
  name: "contactInformation",
  type: "document",
  title: "Test schema",
  fields: [
    defineField({
      name: "address",
      type: "string",
      title: "Address",
    }),
    defineField({
      name: "location",
      type: "geopoint",
      title: "Location",
    }),
  ],
});

Expected behavior

Types should be correctly generated without error.

Screenshots

Captura de pantalla 2024-08-07 a la(s) 10 00 26 a  m

Captura de pantalla 2024-08-07 a la(s) 10 00 02 a  m

Which versions of Sanity are you using?

Run sanity versions in the terminal and copy-paste the result here.

@sanity/cli (global) 3.53.0 (up to date) @sanity/document-internationalization 3.0.0 (up to date) @sanity/google-maps-input 4.0.1 (up to date) @sanity/preview-url-secret 1.6.18 (latest: 1.6.19) @sanity/vision 3.40.0 (latest: 3.53.0) sanity 3.53.0 (up to date)

What operating system are you using?

MacOS Sonoma 14.5

Which versions of Node.js / npm are you running?

Node: v18.20.3 Npm: 10.7.0 Yarn: 1.22.22

Additional context

N/A

cetchebarne commented 2 months ago

Closing as I just noticed this specific function is not yet supported as stated here. According to the docs, it should at least define the type as unknown instead of throwing error though.

devopsboitano commented 1 month ago

Is there any plans to implement the geo namespace?