Struggling with the compose function in Typescript has been a recurring issue for me. Errors keep popping up, and I find the type definition in .d.ts to be quite perplexing. Take this example:
type Props = { t: number };
const foo = (props: {}) => <div {...props} />;
const moo = (props: Props) => <div {...props} />;
const bar = (props: Props) => <div {...props} />;
const Dar = compose(foo, moo)(bar);
const Test = () => <Dar />;
This snippet presents several issues. The error message complains that "bar" lacks the "foo" parameter, even though it does have it.
Moreover, I'm unable to use since Dar is evaluated as JSX.Element rather than a stateless function. Any suggestions or examples on how to effectively utilize compose in Typescript?
Appreciate any insights. Thanks!