In the following code the compiler is throwing error:
Expected 1 arguments, but got 3.
Can anyone explain whats wrong and what needs to be changed? I have other interface based functions that are working fine, but this function doesnt seem to be acknowledging the interface properties.
Code:
interface withTitleComponentProps {
component: Injectable<ReactElement> | ReactElement;
title: string | null | undefined;
isComponent?: boolean;
}
export const withTitleComponent = (props: withTitleComponentProps): React.ComponentType => {
let {component, title, isComponent} = props
if (isComponent) {
return titleComponent({
NewComponent: withInjectedProps(component as Injectable<ReactElement>),
title: title,
});
} else {
return titleElement({
NewComponent: component as ReactElement,
title: title,
});
}
};
props)...withTitleComponent( {LandingScreen, null, true})