Skip to content

Commit d772b2b

Browse files
authored
fix(richtext-lexical): modify JSXConvertersFunction type to support block types in strict mode (#10398)
Reproduction steps: 1. Set `strict: true` in `templates/website/tsconfig.json` 2. You will find a ts error in `templates/website/src/components/RichText/index.tsx`. This is because the blockType property of blocks is generated by Payload as a literal (e.g. "mediaBlock") and cannot be assigned to a string. To test this PR, you can make the change to `JSXConvertersFunction` in node_modules of the website template
1 parent 22c4dee commit d772b2b

File tree

1 file changed

+1
-1
lines changed
  • packages/richtext-lexical/src/exports/react/components/RichText

1 file changed

+1
-1
lines changed

packages/richtext-lexical/src/exports/react/components/RichText/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import './index.css'
1616
export type JSXConvertersFunction<
1717
T extends { [key: string]: any; type?: string } =
1818
| DefaultNodeTypes
19-
| SerializedBlockNode<{ blockName?: null | string; blockType: string }>
19+
| SerializedBlockNode<{ blockName?: null | string }>
2020
| SerializedInlineBlockNode<{ blockName?: null | string; blockType: string }>,
2121
> = (args: { defaultConverters: JSXConverters<DefaultNodeTypes> }) => JSXConverters<T>
2222

0 commit comments

Comments
 (0)