Subscribe on changes!

Vue 3.3.3, defineProps/ defineEmits runtime errors, when both ComponentProps and ComponentEmits types are default exported

avatar
May 18th 2023

Vue version

3.3.4

Link to minimal reproduction

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

Steps to reproduce

  1. Create ComponentProps file with default export
export default interface TestComponentProps {
  msg: string;
}
  1. Create ComponentEmits file with default export
export default interface TestComponentEmits {
  (e: 'click', e: Event): void;
}
  1. Create index.ts file with both exports
export { default as TestComponentProps } from './TestComponentProps';
export { default as TestComponentEmits } from './TestComponentEmits';
  1. Import them in component with script setup
import type { TestComponentProps, TestComponentEmits } from './types';

const props = defineProps<TestComponentProps>();
const emit = defineEmits<TestComponentEmits>();

What is expected?

No errors in runtime and component is rendered correctly

What is actually happening?

Component not rendering throwing exception

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>

System Info

No response

Any additional comments?

Exporting types without "default" works as expected.

avatar
May 29th 2023

@yyx990803 Hi, when is it planned to make 3.3.5 release with this bug fix?