Skip to content

Commit

Permalink
fix(types): add missing typing for PreviewFields
Browse files Browse the repository at this point in the history
  • Loading branch information
mariuslundgard authored and ricokahler committed Sep 7, 2021
1 parent 5bc05a1 commit 4c2169e
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions packages/@sanity/types/parts/part.@sanity/base/other.d.ts
Expand Up @@ -6,9 +6,7 @@ declare module 'all:part:@sanity/base/absolutes' {
declare module 'all:part:@sanity/base/component'

declare module 'all:part:@sanity/base/diff-resolver' {
import type {ComponentType} from 'react'

type DiffComponent = ComponentType<unknown>
type DiffComponent = React.ComponentType<unknown>
type DiffResolver = (schemaType: unknown) => DiffComponent | undefined

const diffResolvers: DiffResolver[]
Expand Down Expand Up @@ -119,7 +117,7 @@ declare module 'part:@sanity/base/new-document-structure?' {
}

declare module 'part:@sanity/base/preview' {
import type {Reference, SchemaType} from '_self_'
import type {Reference, SanityDocument, SchemaType} from '_self_'
import type {Observable} from 'rxjs'

declare const PreviewBase: React.ComponentType<{
Expand Down Expand Up @@ -147,8 +145,15 @@ declare module 'part:@sanity/base/preview' {
value: Record<string, any>
}>

export const PreviewFields: React.ComponentType<{
document: SanityDocument
fields: string | string[]
layout?: 'inline' | 'block' | 'default' | 'card' | 'media'
type: Type
children: (snapshot: SanityDocument) => React.ReactElement
}>

export default PreviewBase
export {PreviewFields} from '@sanity/preview'
}

declare module 'part:@sanity/base/preview?' {
Expand Down

0 comments on commit 4c2169e

Please sign in to comment.