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

fix(types): disambiguate SanityClient imports #445

Merged
merged 1 commit into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions src/stega/SanityStegaClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ import {Observable} from 'rxjs'
import {map} from 'rxjs/operators'

import {defaultConfig} from '../config'
import {ObservableSanityClient, SanityClient} from '../SanityClient'
import {
ObservableSanityClient as INTERNAL_DO_NOT_USE_DIRECTLY_ObservableSanityClient,
SanityClient as INTERNAL_DO_NOT_USE_DIRECTLY_SanityClient,
} from '../SanityClient'
import type {
Any,
ClientConfig,
Expand All @@ -17,7 +20,7 @@ import {stegaEncodeSourceMap} from './stegaEncodeSourceMap'
import {ClientStegaConfig, InitializedClientStegaConfig, InitializedStegaConfig} from './types'

/** @public */
export class ObservableSanityStegaClient extends ObservableSanityClient {
export class ObservableSanityStegaClient extends INTERNAL_DO_NOT_USE_DIRECTLY_ObservableSanityClient {
/**
* Private properties
*/
Expand Down Expand Up @@ -143,7 +146,7 @@ export class ObservableSanityStegaClient extends ObservableSanityClient {
}

/** @public */
export class SanityStegaClient extends SanityClient {
export class SanityStegaClient extends INTERNAL_DO_NOT_USE_DIRECTLY_SanityClient {
/**
* Observable version of the Sanity client, with the same configuration as the promise-based one
*/
Expand Down Expand Up @@ -272,3 +275,8 @@ export class SanityStegaClient extends SanityClient {
})
}
}

export type {
INTERNAL_DO_NOT_USE_DIRECTLY_ObservableSanityClient,
INTERNAL_DO_NOT_USE_DIRECTLY_SanityClient,
}
1 change: 1 addition & 0 deletions src/stega/index.browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const exp = defineCreateClientExports<SanityStegaClient, ClientStegaConfig>(
SanityStegaClient,
)

export type {ObservableSanityClient, SanityClient} from './shared'
export * from './shared'

/** @public */
Expand Down
1 change: 1 addition & 0 deletions src/stega/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const exp = defineCreateClientExports<SanityStegaClient, ClientStegaConfig>(
SanityStegaClient,
)

export type {ObservableSanityClient, SanityClient} from './shared'
export * from './shared'

/** @public */
Expand Down
12 changes: 12 additions & 0 deletions src/stega/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,15 @@ export * from './SanityStegaClient'
export {stegaEncodeSourceMap} from './stegaEncodeSourceMap'
export * from './types'
export {vercelStegaCleanAll} from './vercelStegaCleanAll'

/**
* @deprecated -- Use `import type {SanityClient} from '@sanity/client'` instead
* @public
*/
export type SanityClient = never

/**
* @deprecated -- Use `import type {ObservableSanityClient} from '@sanity/client'` instead
* @public
*/
export type ObservableSanityClient = never