Skip to content

Commit cb258d5

Browse files
committed
BrowserTags: support DocumentFragment
fixes: vanjs-org/van#160
1 parent e604426 commit cb258d5

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/mini-van.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export type PropValue = Primitive | ((e: any) => void) | null
1414
export type Props = Record<string, PropValue | StateView<PropValue> | (() => PropValue)>
1515

1616
export type ValidChildDomValue<ElementType, TextNodeType> =
17-
Primitive | ElementType | TextNodeType | null | undefined
17+
Primitive | DocumentFragment | ElementType | TextNodeType | null | undefined
1818

1919
export type BindingFunc<ElementType, TextNodeType> =
2020
| ((dom?: ElementType | TextNodeType) => ValidChildDomValue<ElementType, TextNodeType>)
@@ -37,9 +37,9 @@ type Tags<ElementType, TextNodeType> = Readonly<Record<string, TagFunc<ElementTy
3737

3838
// Tags type in browser context, which contains the signatures to tag functions that return
3939
// specialized DOM elements.
40-
type BrowserTags = Tags<Element, Text> & {
40+
type BrowserTags = Tags<Element, Text> & ({
4141
[K in keyof HTMLElementTagNameMap]: TagFunc<Element, Text, HTMLElementTagNameMap[K]>
42-
}
42+
})
4343

4444
export interface VanObj<ElementType, TextNodeType> {
4545
readonly state: <T>(initVal: T) => State<T>

src/van-plate.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export type Props = Record<string, PropValue | StateView<PropValue> | (() => Pro
1515

1616
export interface Element { render(): string }
1717

18-
export type ValidChildDomValue = Primitive | Element | null | undefined
18+
export type ValidChildDomValue = Primitive | Element | DocumentFragment | null | undefined
1919

2020
export type BindingFunc = (dom: any) => ValidChildDomValue
2121

0 commit comments

Comments
 (0)