@sanity/client 7.26.2 → 7.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -875,7 +875,7 @@ declare type ClientPerspective_2 =
875
875
  export declare type ClientReturn<
876
876
  GroqString extends string,
877
877
  Fallback = Any,
878
- > = GroqString extends keyof SanityQueries ? SanityQueries[GroqString] : Fallback
878
+ > = GroqString extends keyof SanityQueries_2 ? SanityQueries_2[GroqString] : Fallback
879
879
 
880
880
  /**
881
881
  * @public
@@ -5883,8 +5883,28 @@ export declare interface SanityProjectMember {
5883
5883
  isCurrentUser: boolean
5884
5884
  }
5885
5885
 
5886
- /** @public */
5887
- export declare interface SanityQueries {}
5886
+ /**
5887
+ * The query registry as seen from `@sanity/client`. Inherits every query registered on the global
5888
+ * `SanityQueries` interface, and still accepts the older module augmentation form:
5889
+ * ```ts
5890
+ * declare module '@sanity/client' {
5891
+ * interface SanityQueries {
5892
+ * '*[_type == "post"]': PostsQueryResult
5893
+ * }
5894
+ * }
5895
+ * ```
5896
+ * `@sanity/client` releases that predate the global registry only read this interface, so a
5897
+ * generated file that registers queries globally can bridge them with an augmentation that adds
5898
+ * the global as a base type. It is harmless on releases that already inherit it:
5899
+ * ```ts
5900
+ * declare module '@sanity/client' {
5901
+ * interface SanityQueries extends globalThis.SanityQueries {}
5902
+ * }
5903
+ * ```
5904
+ * @public
5905
+ */
5906
+ declare interface SanityQueries_2 extends globalThis.SanityQueries {}
5907
+ export {SanityQueries_2 as SanityQueries}
5888
5908
 
5889
5909
  /** @internal */
5890
5910
  export declare interface SanityReference {
@@ -6800,3 +6820,27 @@ export declare type WelcomeEvent = {
6800
6820
  }
6801
6821
 
6802
6822
  export {}
6823
+
6824
+ declare global {
6825
+ interface File {}
6826
+ }
6827
+
6828
+ declare global {
6829
+ /**
6830
+ * Query result types, keyed by GROQ query string. Empty by default, `sanity typegen` registers
6831
+ * the queries it finds:
6832
+ * ```ts
6833
+ * declare global {
6834
+ * interface SanityQueries {
6835
+ * '*[_type == "post"]': PostsQueryResult
6836
+ * }
6837
+ * }
6838
+ * ```
6839
+ * `client.fetch(query)` and `ClientReturn<typeof query>` then resolve to the registered type.
6840
+ *
6841
+ * The registry is a global rather than a module augmentation of `@sanity/client` so that it
6842
+ * does not depend on module resolution: it resolves the same whether `@sanity/client` is a
6843
+ * direct dependency, how many copies of it are installed, and from every subpath export.
6844
+ */
6845
+ interface SanityQueries {}
6846
+ }
@@ -875,7 +875,7 @@ declare type ClientPerspective_2 =
875
875
  export declare type ClientReturn<
876
876
  GroqString extends string,
877
877
  Fallback = Any,
878
- > = GroqString extends keyof SanityQueries ? SanityQueries[GroqString] : Fallback
878
+ > = GroqString extends keyof SanityQueries_2 ? SanityQueries_2[GroqString] : Fallback
879
879
 
880
880
  /**
881
881
  * @public
@@ -5883,8 +5883,28 @@ export declare interface SanityProjectMember {
5883
5883
  isCurrentUser: boolean
5884
5884
  }
5885
5885
 
5886
- /** @public */
5887
- export declare interface SanityQueries {}
5886
+ /**
5887
+ * The query registry as seen from `@sanity/client`. Inherits every query registered on the global
5888
+ * `SanityQueries` interface, and still accepts the older module augmentation form:
5889
+ * ```ts
5890
+ * declare module '@sanity/client' {
5891
+ * interface SanityQueries {
5892
+ * '*[_type == "post"]': PostsQueryResult
5893
+ * }
5894
+ * }
5895
+ * ```
5896
+ * `@sanity/client` releases that predate the global registry only read this interface, so a
5897
+ * generated file that registers queries globally can bridge them with an augmentation that adds
5898
+ * the global as a base type. It is harmless on releases that already inherit it:
5899
+ * ```ts
5900
+ * declare module '@sanity/client' {
5901
+ * interface SanityQueries extends globalThis.SanityQueries {}
5902
+ * }
5903
+ * ```
5904
+ * @public
5905
+ */
5906
+ declare interface SanityQueries_2 extends globalThis.SanityQueries {}
5907
+ export {SanityQueries_2 as SanityQueries}
5888
5908
 
5889
5909
  /** @internal */
5890
5910
  export declare interface SanityReference {
@@ -6800,3 +6820,27 @@ export declare type WelcomeEvent = {
6800
6820
  }
6801
6821
 
6802
6822
  export {}
6823
+
6824
+ declare global {
6825
+ interface File {}
6826
+ }
6827
+
6828
+ declare global {
6829
+ /**
6830
+ * Query result types, keyed by GROQ query string. Empty by default, `sanity typegen` registers
6831
+ * the queries it finds:
6832
+ * ```ts
6833
+ * declare global {
6834
+ * interface SanityQueries {
6835
+ * '*[_type == "post"]': PostsQueryResult
6836
+ * }
6837
+ * }
6838
+ * ```
6839
+ * `client.fetch(query)` and `ClientReturn<typeof query>` then resolve to the registered type.
6840
+ *
6841
+ * The registry is a global rather than a module augmentation of `@sanity/client` so that it
6842
+ * does not depend on module resolution: it resolves the same whether `@sanity/client` is a
6843
+ * direct dependency, how many copies of it are installed, and from every subpath export.
6844
+ */
6845
+ interface SanityQueries {}
6846
+ }