From eacffdbdeaef108c8687128449ac1512f47b77b2 Mon Sep 17 00:00:00 2001 From: Doug Parker Date: Fri, 6 Sep 2024 20:51:15 -0700 Subject: [PATCH] Export `ComponentAccessor` and `SignalComponentAccessor` types. We only export types because consumers should not be able to call `ComponentAccessor.fromComponent` on an arbitrary component as this would leak internal details about that component such as its closed shadow root. Consumers should only use these objects via the provided `host` parameter in `defineComponent`. --- src/index.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/index.ts b/src/index.ts index 6c8a4d3..d7d7a5b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -7,3 +7,9 @@ export { ElementAccessor } from './element-accessor.js'; export { type Queryable } from './queryable.js'; export { QueryRoot } from './query-root.js'; export { hydrate, isHydrated } from './hydration.js'; + +// Only export the `ComponentAccessor` object types because consumers should not +// construct these objects directly as doing so would leak internal details +// about components such as a closed shadow root. +export { type ComponentAccessor } from './component-accessor.js'; +export { type SignalComponentAccessor } from './signal-component-accessor.js';