-
-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(better-define): infer TS Extract&Exclude runtime type
discussion #285 vuejs/core#7339 vuejs/core#7337 vuejs/core#6252
- Loading branch information
Showing
4 changed files
with
105 additions
and
2 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,6 @@ | ||
--- | ||
'@vue-macros/better-define': patch | ||
'@vue-macros/api': patch | ||
--- | ||
|
||
infer TS `Extract` and `Exclude` runtime type |
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
14 changes: 14 additions & 0 deletions
14
packages/better-define/tests/fixtures/ts-utility-types.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,14 @@ | ||
<script setup lang="ts"> | ||
type Union = '1' | '2' | '3' | ||
type FooExtract = '1' | '2' | ||
type Foo = Extract<Union, FooExtract> | ||
type BarExclude = '2' | ||
type Bar = Exclude<Union, BarExclude> | ||
defineProps<{ | ||
foo: Foo | ||
bar: Bar | ||
}>() | ||
</script> |