File tree Expand file tree Collapse file tree 5 files changed +17
-10
lines changed
Expand file tree Collapse file tree 5 files changed +17
-10
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import type {TextNode} from "../public/TextNode.js"
1111import { NoIdFieldError } from "../public/NoIdFieldError.js"
1212
1313import type { Descendant } from "./type/Descendant.js"
14+ import type { Simplify } from "./type/Simplify.js"
1415
1516/**
1617 * @api private
@@ -38,16 +39,17 @@ interface ElementWithChildren {
3839 *
3940 * @api private
4041 */
41- type LeafNodeBase < T extends TextNode = TextNode > =
42+ type LeafNodeBase < T extends TextNode = TextNode > = Simplify <
4243 Replace < RenderLeafProps , LeafWithChildren & {
4344 leaf : T
4445 text : T
4546 } >
47+ >
4648
4749/**
4850 * @api private
4951 */
50- type ElementNodeBase < T extends Node = Node > =
52+ type ElementNodeBase < T extends Node = Node > = Simplify <
5153 Replace <
5254 RenderElementProps ,
5355
@@ -60,6 +62,7 @@ type ElementNodeBase<T extends Node = Node> =
6062 attributes : Omit < RenderElementProps [ "attributes" ] , "ref" >
6163 }
6264 >
65+ >
6366
6467/**
6568 * @api private
@@ -74,7 +77,7 @@ type NodeBaseProps<T extends Descendant> = T extends Node
7477 * @api private
7578 */
7679export type NodeProps < T extends Descendant > = Replace < NodeBaseProps < T > , {
77- attributes : Replace < NodeBaseProps < T > [ "attributes" ] , PropsWithKey >
80+ attributes : Simplify < Replace < NodeBaseProps < T > [ "attributes" ] , PropsWithKey > >
7881} >
7982
8083/**
Original file line number Diff line number Diff line change 1- import type { TextNode } from "../../public/TextNode.js"
2-
3- import type { RichText } from "./RichText.js"
1+ import type { TextDescendant } from "./TextDescendant.js"
42import type { Link } from "./Link.js"
53
6- export type InlineDescendant = TextNode | RichText | Link
4+ export type InlineDescendant = TextDescendant | Link
Original file line number Diff line number Diff line change 1- import type { TextNode } from "../../public/TextNode.js"
21import type { Replace } from "../../public/Replace.js"
32import type { Node } from "../../public/Node.js"
43
54import { ELEMENT_LINK } from "../constants.js"
65
7- import type { RichText } from "./RichText .js"
6+ import type { TextDescendant } from "./TextDescendant .js"
87
98interface WithUrl {
109 url : string
1110}
1211
1312export type Link = Replace < Node < typeof ELEMENT_LINK > , {
14- children : Array < TextNode | RichText >
13+ children : TextDescendant [ ]
1514} > & WithUrl
Original file line number Diff line number Diff line change 1+ export type Simplify < T > = { [ K in keyof T ] : T [ K ] } & { }
Original file line number Diff line number Diff line change 1+ import type { TextNode } from "../../public/TextNode.js"
2+
3+ import type { RichText } from "./RichText.js"
4+ import type { EmptyText } from "./EmptyText.js"
5+
6+ export type TextDescendant = EmptyText | RichText | TextNode
You can’t perform that action at this time.
0 commit comments