-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
defineCustomElement type error when component defines emit and imports other component #7782
Comments
I think the issue is that Comp2 doesn't use TS, so it is interpreted as a JS file for TSC. You have two options here:
<template><div></div></template>
<script setup lang="ts"></script> |
@LinusBorg Unfortunately not... I updated the stackblitz. |
I downloaded the repo, and it works fine locally with either of those changes. Though I needed to bust the cache by adding a blank line and saving Comp1.vue or something similar. Edit: Seems to be a problem with vue-tsc. Works fine in the IDE with the changes I propsed, but vue-tsc still fails. That level of instability means its in Volar, I'd say. Red squiggles: No red squiggles: ... but still failing vue-tsc: |
Thanks for clarifiying! I created a new issue at vuejs/language-tools#2450 |
This is defineCustomElement problem, here is minimal reproduction. Instability is another TypeScript issue that can be reproduced in
import { defineCustomElement } from 'vue';
import Comp1Vue from './Comp1.vue';
defineCustomElement(Comp1Vue);
import Comp2 from './Comp2.vue'; // remove this line, tsc error goes away
export default (await import('vue')).defineComponent({
emits: ({} as {
click(): void;
})
})
export default (await import('vue')).defineComponent({}); |
Facing the same issue. When can the fix be review and merged? |
Hello, my team is facing the same issue and it's blocking our use of |
Vue version
3.2.47
Link to minimal reproduction
https://stackblitz.com/edit/vitejs-vite-jbymki?file=src/index.ts
Steps to reproduce
What is expected?
No error
What is actually happening?
System Info
No response
Any additional comments?
This might be an issue related to
vue-tsc
.But judging by the referenced files in the error message, I assume that this type-error resides in the vue codebase.
Context: We want to create a component library that provides Vue and web components.
The text was updated successfully, but these errors were encountered: