We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
PlaceholderProps['fields']
When using the withPlaceholder HOC I'm extending the props type of the wrapped component with PlaceholderComponentProps.
withPlaceholder
PlaceholderComponentProps
type ComponentProps = PlaceholderComponentProps & { fields: ComponentRendering["fields"]; items: ReactNode; }; const Component = () => { // ... }; export default withPlaceholder("items")(Component);
But then TypeScript complains about the fields type being incompatible.
The current type for the fields property in the PlaceholderComponentProps interface:
export interface PlaceholderProps { ... fields?: { [name: string]: Field | Item[]; }; ... }
The type does not match the ComponentFields interface:
ComponentFields
export interface ComponentFields { [name: string]: Field | Item | Item[]; }
Extend rendering component props type with PlaceholderComponentProps.
I believe the type for the fields property in the PlaceholderProps should be:
PlaceholderProps
export interface PlaceholderProps { ... fields?: { [name: string]: Field | Item | Item[]; }; }
This way they match the ComponentFields interface.
No response
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Describe the Bug
When using the
withPlaceholder
HOC I'm extending the props type of the wrapped component withPlaceholderComponentProps
.But then TypeScript complains about the fields type being incompatible.
The current type for the fields property in the
PlaceholderComponentProps
interface:The type does not match the
ComponentFields
interface:To Reproduce
Extend rendering component props type with
PlaceholderComponentProps
.Expected Behavior
I believe the type for the fields property in the
PlaceholderProps
should be:This way they match the
ComponentFields
interface.Possible Fix
No response
Provide environment information
The text was updated successfully, but these errors were encountered: