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

respect createElement return type for JSX #59007

Closed
6 tasks done
LongTengDao opened this issue Jun 24, 2024 · 1 comment
Closed
6 tasks done

respect createElement return type for JSX #59007

LongTengDao opened this issue Jun 24, 2024 · 1 comment

Comments

@LongTengDao
Copy link
Contributor

LongTengDao commented Jun 24, 2024

πŸ” Search Terms

JSX createElement

βœ… Viability Checklist

⭐ Suggestion

respect type information for:

declare namespace React {
    function createElement<Ret extends JSX.Element, Props extends object> (
        component: (props: Props) => Ret,
        props: Props,
    ): Ret;
    namespace JSX {
        interface Element { o: null }
    }
}

function Component (x: {}) { return { o: null, a: null }; }

<Component /> satisfies { o: null, a: null };

πŸ“ƒ Motivating Example

to support framework write limit for children types, i.e. <ul> can only contain <li>;

even algebraic effect handler programming for required provide/inject context.

πŸ’» Use Cases

  1. What do you want to use this for?
  2. What shortcomings exist with current approaches?
  3. What workarounds are you using in the meantime?
@MartinJohns
Copy link
Contributor

Duplicate of #21699.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants