diff --git a/examples/kitchen-sink-vue/src/App.vue b/examples/kitchen-sink-vue/src/App.vue
index feff9f3..9d77913 100644
--- a/examples/kitchen-sink-vue/src/App.vue
+++ b/examples/kitchen-sink-vue/src/App.vue
@@ -3,17 +3,17 @@ import './KitchenSink.js'
import {useTemplateRef} from 'vue'
const sink = useTemplateRef('sink')
-sink.value!.foo
+
+sink.value!.someMethod()
+sink.value!.foo = 123
-
-
+
+
+
+
+
-
+
diff --git a/examples/kitchen-sink-vue/src/KitchenSink.ts b/examples/kitchen-sink-vue/src/KitchenSink.ts
index f256af3..7a8510e 100644
--- a/examples/kitchen-sink-vue/src/KitchenSink.ts
+++ b/examples/kitchen-sink-vue/src/KitchenSink.ts
@@ -1,14 +1,29 @@
+import type {DefineComponent} from 'vue'
+
+// Select the properties to expose to template type checking.
+type KitchenSinkAttributes = 'foo' | 'bar'
+
export class KitchenSink extends HTMLElement {
foo = 123
+ bar = false
+
+ // This is not exposed to template type checking.
+ someMethod() {
+ /* ... */
+ }
}
+
customElements.define('kitchen-sink', KitchenSink)
-import type {Component} from 'vue'
+type VueElementAttribtues =
+ // This is the type that is exposed to template type checking.
+ DefineComponent>> &
+ // Additionally intersect with a constructor type that returns the element type, for refs to work properly.
+ (new () => T)
declare module 'vue' {
interface GlobalComponents {
- // Try toggling between these two lines
- 'kitchen-sink': typeof KitchenSink // not working (except ref works)
- // 'kitchen-sink': Component<{foo: number}> // works (except ref not working)
+ // Use the helper to add any custom element to GlobalComponents.
+ 'kitchen-sink': VueElementAttribtues
}
}