Skip to content

Vue 2.7 strictTemplates error #13104

Open
vuejs/language-tools
#3674
@xiaoxiangmoe

Description

@xiaoxiangmoe

https://github.com/xiaoxiangmoe/issue-vue-2.7-on-click-type-error.git

pnpm run type-check
src/App.vue:12:6 - error TS2559: Type '{ onClick: any; }' has no properties in common with type 'Readonly<Partial<{}> & Omit<Readonly<ExtractPropTypes<{ border: { type: PropType<boolean>; }; }>>, never>>'.

12     <HelloWorld @click="handleClick" />
        ~~~~~~~~~~


Found 1 error in src/App.vue:12

HelloWorld.vue

<script setup lang="ts">

interface ButtonProps {
    border?: boolean; 
}

const props = defineProps<ButtonProps>() 
defineEmits<{
    (event: 'click',payload: MouseEvent): void
}>()
</script>
<template>
    <div id="app">
        <button @click="$emit('click', $event)">Click me</button>
    </div>
</template>

This error come since vue-tsc 1.7.12

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions