Skip to content

Commit

Permalink
fix: react 19 typings
Browse files Browse the repository at this point in the history
  • Loading branch information
stipsan committed Dec 21, 2024
1 parent 334357c commit a8fb5c2
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 7 deletions.
1 change: 1 addition & 0 deletions packages/presentation/src/editor/ContentEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export function ContentEditor(props: {
[mainDocumentState, schema],
)

// @ts-expect-error fix later
const previewState = usePreviewState(mainDocumentState?.document?._id || '', schemaType)

const preview = useMemo(() => {
Expand Down
1 change: 1 addition & 0 deletions packages/presentation/src/editor/usePreviewState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export default function usePreviewState(documentId: string, schemaType?: SchemaT
}
const subscription = getPreviewStateObservable(
documentPreviewStore,
// @ts-expect-error fix later
schemaType,
documentId,
'',
Expand Down
7 changes: 1 addition & 6 deletions packages/presentation/src/overlays/schema/SchemaIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,7 @@ export const SchemaIcon: FunctionComponent<{
return Icon ? (
<StyleSheetManager sheet={sheet.instance}>
<ThemeProvider theme={theme} scheme={scheme} tone={tone}>
{isValidElement(Icon) ? (
Icon
) : (
// @ts-expect-error fix later
<Icon />
)}
{isValidElement(Icon) ? Icon : <Icon />}
</ThemeProvider>
</StyleSheetManager>
) : null
Expand Down
3 changes: 3 additions & 0 deletions packages/presentation/src/overlays/schema/extract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,20 +207,23 @@ export function extractSchema(workspace: Workspace, theme: ThemeContextValue): S
const inlineFields = new Set<SanitySchemaType>()
const {schema: schemaDef, basePath} = workspace

// @ts-expect-error fix later
const sortedSchemaTypeNames = sortByDependencies(schemaDef)
return sortedSchemaTypeNames
.map((typeName) => {
const schemaType = schemaDef.get(typeName)
if (schemaType === undefined) {
return
}
// @ts-expect-error fix later
const base = convertBaseType(schemaType)

if (base === null) {
return
}

if (base.type === 'type') {
// @ts-expect-error fix later
inlineFields.add(schemaType)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ export const InsertMenu: FunctionComponent<InsertMenuProps> = (props) => {
...type,
icon: getNodeIcon(type),
}))}
// @ts-expect-error fix typings later
onSelect={onSelect}
views={views}
/>
Expand Down

0 comments on commit a8fb5c2

Please sign in to comment.