-
-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(volar/export-expose): support generic component (#676)
- Loading branch information
1 parent
c4468c5
commit 505e801
Showing
7 changed files
with
60 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@vue-macros/volar": patch | ||
--- | ||
|
||
support generic component for export-expose |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
playground/vue3/src/examples/export-expose/child-generic.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<script setup lang="ts" generic="T"> | ||
import { ref } from 'vue' | ||
import { Ok } from '../../assert' | ||
export const foo = ref('foo') | ||
export const bar = 'bar' | ||
</script> | ||
|
||
<template> | ||
<Ok /> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,13 @@ | ||
/// <reference types="vite/client" /> | ||
/// <reference types="unplugin-vue-macros/macros-global" /> | ||
|
||
declare type ComponentExposed<T> = T extends new (...args: any) => infer E | ||
? E | ||
: T extends ( | ||
props: any, | ||
ctx: any, | ||
expose: (exposed: infer E) => any, | ||
...args: any | ||
) => any | ||
? NonNullable<E> | ||
: any |