Skip to content

Commit

Permalink
Merge branch 'master' into context-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
JoviDeCroock authored Jan 30, 2023
2 parents 9f0c2a4 + 15913ad commit e61c9a1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,19 @@ export namespace h {
// Preact render
// -----------------------------------

interface ContainerNode {
nodeType: Node['nodeType'];
parentNode: Node['parentNode'];
firstChild: Node['firstChild'];
insertBefore: Node['insertBefore'];
appendChild: Node['appendChild'];
removeChild: Node['removeChild'];
childNodes: ArrayLike<Node>
}

export function render(
vnode: ComponentChild,
parent: Element | Document | ShadowRoot | DocumentFragment
parent: ContainerNode
): void;
/**
* @deprecated Will be removed in v11.
Expand All @@ -286,12 +296,12 @@ export function render(
*/
export function render(
vnode: ComponentChild,
parent: Element | Document | ShadowRoot | DocumentFragment,
parent: ContainerNode,
replaceNode?: Element | Text
): void;
export function hydrate(
vnode: ComponentChild,
parent: Element | Document | ShadowRoot | DocumentFragment
parent: ContainerNode
): void;
export function cloneElement(
vnode: VNode<any>,
Expand Down
6 changes: 6 additions & 0 deletions test/ts/preact.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@ render(
document
);

// Mounting into different types of Nodes
render(h('div', {}), document.createElement('div'));
render(h('div', {}), document);
render(h('div', {}), document.createElement('div').shadowRoot!);
render(h('div', {}), document.createDocumentFragment());

// Accessing children
const ComponentWithChildren: FunctionalComponent<DummerComponentProps> = ({
input,
Expand Down

0 comments on commit e61c9a1

Please sign in to comment.