Skip to content

TypeScript defs for Helper Functions with Hooks #72

@eddiewang

Description

@eddiewang

The README shows a declarative approach to writing hook-based react-async resolvers. However, if implemented with Typescript, the following error appears:

const Rejected: <T>(props: {
    children?: AsyncChildren<T>;
    persist?: boolean;
}) => JSX.Element
Type '{ children: (error: AsyncState<unknown>) => Element; state: AsyncState<StandardResp<CoinProfileResp>>; }' is not assignable to type 'IntrinsicAttributes & { children?: AsyncChildren<unknown>; persist?: boolean; }'.
  Property 'state' does not exist on type 'IntrinsicAttributes & { children?: AsyncChildren<unknown>; persist?: boolean; }'.

Going into the definitions, it seems like state isn't considered a prop that is passed through. The same goes for Pending and Fufilled components.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions