This repository was archived by the owner on Sep 10, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
compose hoc causes to lose typings #785
Copy link
Copy link
Open
Description
We use recompose@0.30.0 and @types/recompose@0.30.7 with the latest React. I'm not sure why, but for some reason, compose() HOC causes to loose typings for React component.
To demonstrate it I've created following simple code:
import React, { Component, FunctionComponent } from 'react';
import { compose } from 'recompose';
type Component1Props = {
test: string;
};
const Component1: FunctionComponent<Component1Props> = ({ test }) => <div>{test}</div>;
const enhance = compose<Component1Props, Component1Props>();
export { Component1 };
export default enhance(Component1);Here is what typescript generates in result:
import { FunctionComponent } from 'react';
declare type Component1Props = {
test: string;
};
declare const Component1: FunctionComponent<Component1Props>;
export { Component1 };
declare const _default;
export default _default;
//# sourceMappingURL=component1.d.ts.mapAs you can see, Component1 without compose() generates types normally, but once we apply compose(), we're going to lose all types.
Could you please advise how to keep types for components when we use compose()?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
