defineEmits with union operator bug
See original GitHub issueFirstly, thanks for all your work on vue-tsc!
When using union operator in defineEmits:
<script setup lang="ts">
defineEmits<{
(e: "a" | "b"): string;
}>();
const count = 0;
</script>
<template>
{{ count }}
</template>
vue-tsc is unable to find variables in the component template:
You can find a repro at this repository: https://github.com/leonzalion/vue-tsc-bug
Let me know if you need any more information and/or if I’m missing anything
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Vue 3 defineEmits breaks defineProps types - Stack Overflow
The defineEmits<T>() generic argument is essentially a TypeScript interface that defines only functions, which receive a specific event name ...
Read more >@vue/compiler-sfc | Yarn - Package Manager
Bug Fixes. compiler/v-model: catch incorrect v-model usage on prop bindings (001184e), closes #5584; custom-elements: also dispatch hyphenated version of ...
Read more >IntelliJ IDEA 2022.3 (223.7571.182 build) Release Notes
Bug, IDEA-297638, SpEL: Safe Navigation operator does not work with list Selection or Projection ... Support new operation keys: union, intersect, except.
Read more >Understanding the new script setup with (defineProps ... - Netlify
defineEmits – lets us define the events that our component can emit. In this case, we emit a subscribe event to let the...
Read more >Become a ninja with Vue 3 - the ebook
Rest operator. Classes. Promises ... Union types and type guards. 6. The wonderful land of Web ... Error handling with onErrorCaptured. Suspense events....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks for the report!
I took a look at the test code for
difineEmits
itself. There seems to be a test for the Union type.