Skip to content
This repository has been archived by the owner on Sep 2, 2024. It is now read-only.

TypeScript: m.fragment without Attrs not allowed #43

Open
ArthurClemens opened this issue Mar 13, 2021 · 1 comment
Open

TypeScript: m.fragment without Attrs not allowed #43

ArthurClemens opened this issue Mar 13, 2021 · 1 comment
Assignees

Comments

@ArthurClemens
Copy link

Error:

Expected 2 arguments, but got 1.ts(2554)
index.d.ts(57, 71): An argument for 'children' was not provided.

image

This can be solved by adding a second entry in the d.ts:

/** Creates a fragment virtual element (Vnode). */
fragment(attrs: Lifecycle<any, any> & { [key: string]: any }, children: ChildArrayOrPrimitive): Vnode<any, any>;
fragment(children: ChildArrayOrPrimitive): Vnode<any, any>;
@dead-claudia dead-claudia transferred this issue from MithrilJS/mithril.js Mar 14, 2021
@dead-claudia
Copy link
Member

@spacejack Also, the TS defs need updated to accept variadic children to align with the current hyperscript API (the ...args in m(Comp, ...args) and in m.fragment(...args) is handled the exact same way behind the scenes, so they should have identical prototypes).

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

No branches or pull requests

3 participants