I have a little problem using the build function in Typescript, I always get errors. Type definition in .d.ts is also rather confusing. For 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 />;
It has a few problems. He complains that "bar" does not have the parameter "foo" (which it really has).
Also, I cannot use it, since Dar is evaluated as JSX.Element, not a stateless function. Any IDEA with a possible example of using composition in Typescript?
Thanks.
source
share