-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: move types to runtime entrypoint
- Loading branch information
Showing
4 changed files
with
46 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,44 @@ | ||
import type { SanityClient } from '@sanity/client' | ||
|
||
import type { SanityModuleOptions, CONFIG_KEY } from './module' | ||
|
||
import type { createClient } from './client' | ||
|
||
const HELPER_KEY: `$${typeof CONFIG_KEY}` = '$sanity' | ||
|
||
export * from './client' | ||
export * from './helpers' | ||
|
||
interface Client { | ||
client: SanityClient | ||
config: Pick<SanityModuleOptions, 'useCdn' | 'projectId' | 'dataset' | 'withCredentials' | 'token'> | ||
fetch: ReturnType<typeof createClient>['fetch'] | ||
setToken: (token: string) => void | ||
} | ||
|
||
type SanityHelper = Record<string, Client> & Client | ||
|
||
declare module '@nuxt/types' { | ||
interface NuxtOptions { | ||
[CONFIG_KEY]: SanityModuleOptions | ||
} // Nuxt 2.14+ | ||
interface Configuration { | ||
[CONFIG_KEY]: SanityModuleOptions | ||
} // Nuxt 2.9 - 2.13 | ||
interface NuxtAppOptions { | ||
[HELPER_KEY]: SanityHelper | ||
} | ||
} | ||
|
||
declare module 'vue/types/vue' { | ||
interface Vue { | ||
[HELPER_KEY]: SanityHelper | ||
} | ||
} | ||
|
||
declare module 'vuex/types/index' { | ||
// eslint-disable-next-line | ||
interface Store<S> { | ||
[HELPER_KEY]: SanityHelper | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters