From accb4c70f6dde46674fd9d0ea12fd782b520b1cf Mon Sep 17 00:00:00 2001 From: Ryan Christian Date: Mon, 22 Apr 2024 14:30:51 -0500 Subject: [PATCH] feat: Add compat/client types --- compat/client.d.ts | 11 +++++++++++ compat/package.json | 1 + package.json | 2 ++ 3 files changed, 14 insertions(+) create mode 100644 compat/client.d.ts diff --git a/compat/client.d.ts b/compat/client.d.ts new file mode 100644 index 0000000000..5024a565dc --- /dev/null +++ b/compat/client.d.ts @@ -0,0 +1,11 @@ +import * as preact from '../src'; + +export function createRoot(container: preact.ContainerNode): { + render(children: preact.VNode): void; + unmount(): void; +}; + +export function hydrateRoot( + container: preact.ContainerNode, + children: preact.VNode +): typeof createRoot; diff --git a/compat/package.json b/compat/package.json index 07b4669612..bb80a0fa7a 100644 --- a/compat/package.json +++ b/compat/package.json @@ -25,6 +25,7 @@ "require": "./dist/compat.js" }, "./client": { + "types": "./client.d.ts", "import": "./client.mjs", "require": "./client.js" }, diff --git a/package.json b/package.json index 688d96ee47..3b3fc759a8 100644 --- a/package.json +++ b/package.json @@ -67,6 +67,7 @@ "require": "./jsx-runtime/dist/jsxRuntime.js" }, "./compat/client": { + "types": "./compat/client.d.ts", "import": "./compat/client.mjs", "require": "./compat/client.js" }, @@ -209,6 +210,7 @@ "dist", "compat/dist", "compat/src", + "compat/client.d.ts", "compat/client.js", "compat/client.mjs", "compat/server.browser.js",