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

when both emit and model defined, plus import emit type from another file, component loses type #4824

Open
RayGuo-ergou opened this issue Sep 8, 2024 · 4 comments

Comments

@RayGuo-ergou
Copy link
Contributor

RayGuo-ergou commented Sep 8, 2024

Vue - Official extension or vue-tsc version

2.1.6

VSCode version

none

Vue version

3.5.3

TypeScript version

5.5.4

System Info

System:
    OS: Linux 5.15 Ubuntu 22.04.4 LTS 22.04.4 LTS (Jammy Jellyfish)
    CPU: (16) x64 AMD Ryzen 7 7800X3D 8-Core Processor
    Memory: 40.29 GB / 46.66 GB
    Container: Yes
    Shell: 5.8.1 - /usr/bin/zsh
  Binaries:
    Node: 20.17.0 - ~/.n/bin/node
    npm: 10.8.2 - ~/.n/bin/npm
    pnpm: 9.9.0 - ~/.n/bin/pnpm
    bun: 1.0.26 - ~/.bun/bin/bun

package.json dependencies

No response

Steps to reproduce

To reproduce, these requirement has to meet

  1. Define emits
  2. Define model
  3. The emit type extends radix-vue's type

Then the component inside template will have type of unknown.

Should be able to reproduce with the repo provided below. Here's some screenshots

image
image
image
image

What is expected?

Having correct type for components.

What is actually happening?

Infer as unknown

Link to minimal reproduction

https://github.com/RayGuo-ergou/volar-reproduction

Any additional comments?

possible related to #4822 ?

Also the current radix-vue is built with 2.0.x so this might caused this issue?

@RayGuo-ergou
Copy link
Contributor Author

image
Type union is okay

image
Interface extends is not

@RayGuo-ergou
Copy link
Contributor Author

Found another issue, if params passed into defineModel, the params type of emits will be unknown []
image
image

@KazariEX
Copy link
Collaborator

KazariEX commented Sep 8, 2024

Could the fix #4823 solve this?

@RayGuo-ergou
Copy link
Contributor Author

Potentially yes, I will report back once it's merged and released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants