Skip to content

defineEmits() type cannot use computed keys #8040

Closed
@sqal

Description

@sqal

Vue version

>= 3.3.0.alpha.7

Link to minimal reproduction

https://sfc.vuejs.org/#eNqNULtuwzAM/BVCSx6wrV11AnToL3SpOrg24yqwHhApdwj875WSDO4DRReKJ4p3uruIxxCaOaFQoqU+msBAyCnA1LnxoAWTFkftAOS+1N47YkBrGA4w4Mk4fMqA2kuZAmxRwSaFoWNU1g84PXdTwk0FczkVEEfjxp2C2ZuhrCzH7e6hNHtZ6n80fuFX8PJF4HVF3cqbr+wiA0Ybprx9Q3IFRSWMDT5ybbvQnMm7nMlVUt8HOQoF909okUMrWIt35kBKSjr1JckzNT6OMndNTI6NxQbJ1m/RfxDGTKxFteKQ+XLGWEd0A0aMf3F+e/qD9+pau0UsnwwOoOY=

Steps to reproduce

<script setup lang="ts">
  const emit = defineEmits<{
    'update:modelValue': [value: string]
  }>();
</script>

What is expected?

Should compile component without error.

What is actually happening?

Error: [@vue/compiler-sfc] defineEmits() type cannot use computed keys.

App.vue
8  |    
9  |    const emit = defineEmits<{
10 |      'update:modelValue': [value: string]
   |      ^^^^^^^^^^^^^^^^^^^
11 |    }>();
12 |  </script>

It seems bug was introduced in commit ef73ea5

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions