@sprlab/wccompiler 0.4.1 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -0
- package/package.json +1 -1
- package/types/wcc.d.ts +1 -1
package/README.md
CHANGED
|
@@ -391,6 +391,15 @@ defineExpose({ doubled, handleUpdate, watchLog })
|
|
|
391
391
|
|
|
392
392
|
`defineExpose()` exposes methods and properties for external access via ref.
|
|
393
393
|
|
|
394
|
+
The language server automatically generates a typed interface (PascalCase of the tag name) that can be imported by consumers:
|
|
395
|
+
|
|
396
|
+
```ts
|
|
397
|
+
// In the parent component:
|
|
398
|
+
import type { WccTypescript } from './wcc-typescript.wcc'
|
|
399
|
+
const child = templateRef<WccTypescript>('myRef')
|
|
400
|
+
child.value!.handleUpdate() // ✅ typed
|
|
401
|
+
```
|
|
402
|
+
|
|
394
403
|
## CLI
|
|
395
404
|
|
|
396
405
|
```bash
|
package/package.json
CHANGED
package/types/wcc.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ declare module 'wcc' {
|
|
|
19
19
|
export function defineEmits<T>(): T;
|
|
20
20
|
export function defineEmits(names: string[]): (name: string, detail?: any) => void;
|
|
21
21
|
|
|
22
|
-
export function templateRef<T = HTMLElement>(name: string): { value:
|
|
22
|
+
export function templateRef<T = HTMLElement>(name: string): { value: T | null };
|
|
23
23
|
|
|
24
24
|
export function onMount(fn: () => void | Promise<void>): void;
|
|
25
25
|
export function onDestroy(fn: () => void | Promise<void>): void;
|