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

[bug] type checking of ElementChildrenAttribute failed with JsxVNodeChildren #1022

Open
TechQuery opened this issue Jun 7, 2022 · 2 comments

Comments

@TechQuery
Copy link
Contributor

Example

JSX declaration

import { VNode, JsxVNodeChildren } from 'snabbdom';

declare global {
    namespace JSX {
        type Element = VNode;

        interface ElementChildrenAttribute {
            defaultSlot: JsxVNodeChildren;
        }
    }
}

JSX code

<section>
    <h2>xxx</h2>

    {[1, 2, 3].map(value => <span>{value}</span>)}
    {/* Type 'VNode[]' is not assignable to type 'JsxVNodeChild'. ts(2322) */}
</section>

Context

https://github.com/EasyWebApp/WebCell/blob/c1e69152ab4fa5d219469deaf310ef5a483d8861/source/utility/vDOM.ts#L59-L61

Environment

  • SnabbDOM: 3.5.0
  • TypeScript: 4.7.3
@jvanbruegge
Copy link
Member

You should not need any JSX declaration, snabbdom already provides these

@TechQuery
Copy link
Contributor Author

TechQuery commented Jun 22, 2022

But WebCell has more property types for DOM & Component node, and SnabbDOM's h() & Fragment() are not fulfilled all my situations, so I need some wrappers.

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