Skip to content

Commit

Permalink
chore: fix remainder type issues
Browse files Browse the repository at this point in the history
  • Loading branch information
stipsan committed Jan 3, 2025
1 parent e2c6698 commit 7de727d
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,7 @@ function renderMedia(props: {

if (isValidElementType(media)) {
const MediaComponent = media
return (
<MediaComponent
// @ts-expect-error - @TODO fix typings
dimensions={dimensions}
layout={layout}
/>
)
return <MediaComponent dimensions={dimensions} layout={layout} />
}

if (typeof media === 'string') {
Expand Down
15 changes: 2 additions & 13 deletions packages/sanity/src/core/components/previews/helpers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,7 @@ export function renderPreviewMedia<Layout = PreviewLayoutKey>(
): ReactNode {
if (isValidElementType(value)) {
const Value = value
return (
<Value
// @ts-expect-error - @TODO fix typings
layout={layout}
dimensions={dimensions}
/>
)
return <Value layout={layout} dimensions={dimensions} />
}

if (typeof value === 'string') {
Expand All @@ -38,12 +32,7 @@ export function renderPreviewNode<Layout = PreviewLayoutKey>(

if (isValidElementType(value)) {
const Value = value
return (
<Value
// @ts-expect-error - @TODO fix typings
layout={layout}
/>
)
return <Value layout={layout} />
}

// @todo: find out why `value` isn't infered as `ReactNode` here
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,20 +86,14 @@ export function TemplatePreview(props: TemplatePreviewProps) {
<Stack flex={1} space={2}>
{isValidElementType(Title) && (
<Text textOverflow="ellipsis">
<Title
// @ts-expect-error - @todo fix typings
layout="default"
/>
<Title layout="default" />
</Text>
)}
{isValidElement(Title) && <Text textOverflow="ellipsis">{Title}</Text>}

{isValidElementType(Subtitle) && (
<Text muted size={1} textOverflow="ellipsis">
<Subtitle
// @ts-expect-error - @todo fix typings
layout="default"
/>
<Subtitle layout="default" />
</Text>
)}
{isValidElement(Subtitle) && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ const DialogTimeZone = (props: DialogTimeZoneProps) => {
options={allTimeZones}
padding={4}
placeholder="Search for a city or time zone"
// @ts-expect-error - fixed in a new version of @sanity/ui
popover={{
boundaryElement: document.querySelector('body'),
constrainSize: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ export function UserComponentPane(props: UserComponentPaneProps) {
// NOTE: here we're utilizing the function form of refs so setting
// the ref causes a re-render for `UserComponentPaneHeader`
ref={setRef as any}
// @ts-expect-error - @TODO Fix typings
child={child}
paneKey={paneKey}
/>
Expand Down
3 changes: 2 additions & 1 deletion packages/sanity/src/ui-components/menuGroup/MenuGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ export type MenuGroupProps = Pick<UIMenuGroupProps, 'icon' | 'popover' | 'text'
* @internal
*/
export const MenuGroup = (
props: MenuGroupProps & Omit<HTMLProps<HTMLDivElement>, 'as' | 'height' | 'ref' | 'tabIndex'>,
props: MenuGroupProps &
Omit<HTMLProps<HTMLDivElement>, 'as' | 'height' | 'ref' | 'tabIndex' | 'popover'>,
) => {
return <UIMenuGroup {...props} fontSize={1} padding={3} />
}

0 comments on commit 7de727d

Please sign in to comment.