You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
IMO, kids parameter should be marked as optional. This is just a typing change, no change in impl. needed.
I understand that just empty lists have no equivalent in markdown (and hence probably the existing decision), but it also enables other usecases (like building step-by-step). Also, it is somewhat in the same spirit as allowing empty kids in heading.
Use case -
This will allow users to build lists in two steps, like:
Given that the "vanilla JS" implementation of "starting with an empty list and building later" is
constlist=[];list.push("item");
having to explicitly pass an empty array as an argument feels analogous to the empty array declaration.
I see value in catching errors (through type-checking) where users fail to pass children as an argument, and am not yet convinced that the benefits associated with what you're proposing
Ref line -
mdast-builder/src/index.ts
Lines 89 to 95 in 9efc3da
IMO, kids parameter should be marked as optional. This is just a typing change, no change in impl. needed.
I understand that just empty lists have no equivalent in markdown (and hence probably the existing decision), but it also enables other usecases (like building step-by-step). Also, it is somewhat in the same spirit as allowing empty kids in heading.
Use case -
This will allow users to build lists in two steps, like:
This is how things are typically handled in some converters (to md).
(Its not a major issue though, can be skipped using empty array as child)
The text was updated successfully, but these errors were encountered: