Skip to content
New issue

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

Unexpected unknown when used with React components and other generic function types #3

Closed
OliverJAsh opened this issue Jul 5, 2019 · 0 comments · Fixed by #4
Closed
Labels
bug Something isn't working

Comments

@OliverJAsh
Copy link
Member

OliverJAsh commented Jul 5, 2019

Filed a TS bug: microsoft/TypeScript#32269

type ComponentType<P> = {
    (p: P): null;
    p?: P;
};

declare const myHoc: <Props>(
    ComposedComponent: ComponentType<Props>,
) => ComponentType<Props>;

declare const Component: (props: {}) => null;

// unknown, expected ComponentType<{}>
const result = pipe(
    () => Component,
    myHoc,
)();
@OliverJAsh OliverJAsh added the bug Something isn't working label Jul 5, 2019
OliverJAsh added a commit that referenced this issue Jul 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant