Skip to content

Commit

Permalink
provide correct parseContent
Browse files Browse the repository at this point in the history
  • Loading branch information
eunjae-lee authored and BibiSebi committed Sep 12, 2023
1 parent 372e765 commit b4dd69d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/demo/src/components/FieldPluginDemo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import { useFieldPlugin } from '@storyblok/field-plugin/react'
import { ModalView } from './ModalView'
import { NonModalView } from './NonModalView'

type Content = unknown
const parseContent = (content: unknown) =>
typeof content === 'number' ? content : 0
type Content = ReturnType<typeof parseContent>

export type PluginComponent = FunctionComponent<{
data: FieldPluginData<Content>
Expand All @@ -15,7 +17,7 @@ export type PluginComponent = FunctionComponent<{

export const FieldPluginDemo: FunctionComponent = () => {
const { type, data, actions } = useFieldPlugin({
parseContent: (content: Content) => content,
parseContent,
})

if (type === 'loading') {
Expand Down

0 comments on commit b4dd69d

Please sign in to comment.