question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

defineEmits with union operator bug

See original GitHub issue

Firstly, 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: vue-tsc-error

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:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
johnsoncodehkcommented, Feb 12, 2022

Thanks for the report!

1reaction
yaegassycommented, Feb 3, 2022

I took a look at the test code for difineEmits itself. There seems to be a test for the Union type.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found