Skip to content

Commit

Permalink
fix(types): disambiguate SanityClient imports (#445)
Browse files Browse the repository at this point in the history
  • Loading branch information
stipsan authored Dec 7, 2023
1 parent 527393d commit b4b9079
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 3 deletions.
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

0 comments on commit b4b9079

Please sign in to comment.