Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
tragid opened this issue May 18, 2023 · 2 comments
Closed
Labels
has workaround A workaround has been found to avoid the problem

Comments

@tragid
Copy link

tragid commented May 18, 2023

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>();
@yyx990803 yyx990803 added the has workaround A workaround has been found to avoid the problem label May 18, 2023
@tragid
Copy link
Author

tragid commented May 18, 2023

@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

@yyx990803
Copy link
Member

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
has workaround A workaround has been found to avoid the problem
Projects
None yet
Development

No branches or pull requests

2 participants