Skip to content

Commit

Permalink
Allow both Function and Class components as node renderers
Browse files Browse the repository at this point in the history
  • Loading branch information
e1himself committed Jan 5, 2022
1 parent a8e0518 commit 40bda85
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ import {
QuoteNode,
TextNode,
} from '@prezly/slate-types';
import type { FunctionComponent } from 'react';
import type { ComponentType } from 'react';

export type NodeRenderer<T extends Node> = FunctionComponent<{ node: T }>;
export type NodeRenderer<T extends Node> = ComponentType<{ node: T }>;

export type TextRenderer = FunctionComponent<TextNode & { children?: never }>;
export type TextRenderer = ComponentType<TextNode & { children?: never }>;

export interface ComponentRenderers {
[ATTACHMENT_NODE_TYPE]?: NodeRenderer<AttachmentNode>;
Expand Down

0 comments on commit 40bda85

Please sign in to comment.