-
-
Notifications
You must be signed in to change notification settings - Fork 421
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b267241
commit e984392
Showing
2 changed files
with
22 additions
and
0 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,10 @@ | ||
<script lang="ts"> | ||
type SwitchByBoolean<T extends boolean, V> = false extends T ? V : V[]; | ||
</script> | ||
|
||
<script lang="ts" setup generic="T extends boolean, V extends SwitchByBoolean<T, string>"> | ||
defineProps<{ | ||
modelValue?: V; | ||
multiple?: T; | ||
}>(); | ||
</script> |
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,12 @@ | ||
<template> | ||
<HelloWorld :multiple="true" :modelValue="['a']" /> | ||
<HelloWorld :multiple="false" :modelValue="'a'" /> | ||
<!-- @vue-expect-error --> | ||
<HelloWorld :multiple="false" :modelValue="['a']" /> | ||
<!-- @vue-expect-error --> | ||
<HelloWorld :multiple="true" :modelValue="'a'" /> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
import HelloWorld from './component.vue' | ||
</script> |