vuejs / core

🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

Home Page:https://vuejs.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Vue 3.3.3, defineProps/ defineEmits could not resolve default exported types

tragid opened this issue · comments

commented

Vue version

3.3.3

Link to minimal reproduction

https://github.com/tragid/vue-default-export-error

Steps to reproduce

  1. Create props interface file: TestComponentProps.ts
  2. Create default export from file
export default interface TestComponentProps {
  msg: string;
}
  1. import type within component TestComponent.vue
import type TestComponentProps from './TestComponentProps';

const props = defineProps<TestComponentProps>();
  1. Vue throws error on startup.
    [@vue/compiler-sfc] Unresolvable type reference or unsupported built-in utility type

What is expected?

Vue can resolve defaultly imported types

What is actually happening?

Vue throws error on startup.
[@vue/compiler-sfc] Unresolvable type reference or unsupported built-in utility type

System Info

No response

Any additional comments?

Everything works, if I create export from file with no default provided

export interface TestComponentProps {
  msg: string;
}
import type { TestComponentProps } from './TestComponentProps';

const props = defineProps<TestComponentProps>();
commented

@yyx990803
Hi! Fix helped to get rid of compile time errors.
Now having runtime errors, when importing default Props and default Emits in a row.

runtime-core.esm-bundler.js:41 [Vue warn]: Property "tag" was accessed during render but is not defined on instance. 
  at <TestComponent msg="Hello World!" tag="span" onClick=fn<onClick> > 
  at <App>

I have created a branch with 3.3.4 version with minimal reproduction: https://github.com/tragid/vue-default-export-error/tree/vue-3.3.4

Please open a separate issue so that it can be tracked as a different bug.