unplugin / unplugin-vue2-script-setup

💡 Bring `<script setup>` to Vue 2.
MIT License
599 stars 39 forks source link

typescript: defineProps and defineEmits not co-op in type checking #31

Closed TrungRueta closed 3 years ago

TrungRueta commented 3 years ago

Hi!

I'm using plugin v0.5.4 in Nuxt. with simple component use both defineProps and defineEmits i see type checking report error:

normal, when only use defineProps component checking ok:

without defineEmits

when add defineEmis, all props reference in template lost:

with defineEmits

This error only happend with type checking, runtime still work.

Thankyou!

antfu commented 3 years ago

Have you configured this? https://github.com/antfu/unplugin-vue2-script-setup#global-types

TrungRueta commented 3 years ago

@antfu yes, this is in my tsconfig.json:

"types": [
      "@nuxt/types",
      "@types/node",
      "@nuxt/image",
      "@nuxtjs/firebase",
      "unplugin-vue2-script-setup/types",
      "unplugin-vue2-script-setup/ref-macros"
    ]

also, i found in readme we missing a thing about different between vue2's template and vue3's template type checking. i will post other issue for track better.

antfu commented 3 years ago

Fixed in @vue/composition-api 1.1.4, please update and try out