Skip to content

fix: break and thematic-break should not have children #78

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

Merged
merged 1 commit into from
May 7, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion libraries/from-bodyxml/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function toValidLayoutWidth(layoutWidth) {

/**
* @template {UNode | UParent} Node
* @typedef {Omit<Node, "children"> & (Node extends UParent ? {children?: Node["children"]} : {children?: null})} TransNode
* @typedef {Omit<Node, "children"> & (Node extends UParent ? {children?: Node["children"]} : {children: null})} TransNode
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes the type hinting in this file to error if a childless transformer does not have children: null

*/

export let defaultTransformers = {
Expand Down Expand Up @@ -125,6 +125,7 @@ export let defaultTransformers = {
br(br) {
return {
type: "break",
children: null,
};
},
/**
Expand All @@ -133,6 +134,7 @@ export let defaultTransformers = {
hr(hr) {
return {
type: "thematic-break",
children: null,
};
},
/**
Expand Down
Loading