Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change reactrenderer component type definition #2327

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions packages/react/src/ReactRenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ export interface ReactRendererOptions {
className?: string,
}

type ComponentType<R> =
| React.ComponentClass
| React.FunctionComponent
| React.ForwardRefExoticComponent<{ items: any[], command: any } & React.RefAttributes<R>>
type ComponentType<R, P> =
React.ComponentClass<P> |
React.FunctionComponent<P> |
React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<R>>;

export class ReactRenderer<R = unknown> {
export class ReactRenderer<R = unknown,P = unknown> {
id: string

editor: ExtendedEditor
Expand All @@ -44,7 +44,7 @@ export class ReactRenderer<R = unknown> {

ref: R | null = null

constructor(component: ComponentType<R>, {
constructor(component: ComponentType<R, P>, {
editor,
props = {},
as = 'div',
Expand Down