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

Component v-model throw warning "Component emitted event "update:modelValue" but it is neither declared in the emits option nor as an "onUpdate:modelValue" prop." when using with interface #8643

Closed
minhtien020900 opened this issue Jun 26, 2023 · 1 comment

Comments

@minhtien020900
Copy link

Vue version

3.3.4

Link to minimal reproduction

https://play.vuejs.org/#eNqNVMFy0zAQ/ZVFB5zOhOTAzThmaKcMcIAOMHDRxbE3iVpZ8khy0o7xv7Mr13ETKEMukXbf7r7dfVYn3jXNYt+iSEXmS6eaAB5D2+TSqLqxLkAHDjfQw8bZGhKCJkfX1U7p6srSxaAJj4jF8tTM2ZM30khTWuMD1H4LK845Sz6g1hZ+WqerF8mFNNlyoEDF6RKwbnQRkG4AXUdxfc/H7Kzs/lVtK9QrKQgiRZ6dEaD4bHlMJuYieGKyUdvFrbeGGu84qxQlBSiN7ksTFDGVIoXoYV9BRA+foi24FuejvdxhefcX+62/Z5sUNw49uj1KcfSFwm0xDO7rb5/xns5HJ7XSakL/w/kVvdUtcxxgl62piPYTXGT7Me5Ime13f30f0PixKSbKyD7ipaD98Kyea32i+3rxOsZJ09MU/9zyuYZAF2ZLawmUMJfuVFFzHncbsDqVFqEi0gR0m6JEeG8tBcAMU0japqIVpnHdPwpN+Dns+f9tCmtrNRYGfoEPjrqmg13fYhnoYNp6je4ihb1VVI8LDFpsnG08qbHCjTJ4w7esm9KnhXno89nFyGq5hNUqh7Bz9gCHwhHNLSgDnIyqg9pA6wfbSP+ycEBLRFN5buW0tzMn9RnbXBcuOSF7Vv9g3R0Y6+pCTyXDQ0MEOLWnpmmLcFBhxyU8h0Y3X6hbLvXyf4oNQ8JahWlI13zLOBMNJtJpaZh1zV9isBDQh2m+z4Ry5FhmAMYtEnAURUaTz2cdA1iFJMAUuFxOuny08c+RzJwZ1riY9jZCSOGPJ9IjJaAqY6vnmSLT2XMKiwqIGUfa/VEU06M1GqaHK0ZlylBPT56p2KwUEP1Pn6b+N65m54g=

Steps to reproduce

Initial:

  • Make interface Foo:
    interface Foo { (e: 'update:modelValue', value?: boolean | string | object | number): void }

Using with extends interface:

  • create interface Bar extends Foo
  • pass interface Foo to defineEmits
    interface Bar extends Foo { (e: 'bar'): void }
    ==>throw warning when updating modelValue

Using with type intersection:

  • create type Bars = Foo & { (e: 'bar'): void }
    ==> work normal

What is expected?

update modelValue working without warning

What is actually happening?

update modelValue throw warning:
Component emitted event "update:modelValue" but it is neither declared in the emits option nor as an "onUpdate:modelValue" prop.

System Info

No response

Any additional comments?

No response

@minhtien020900 minhtien020900 changed the title Component v-model throw warning when using with interface Component v-model throw warning "Component emitted event "update:modelValue" but it is neither declared in the emits option nor as an "onUpdate:modelValue" prop." when using with interface Jun 26, 2023
@baiwusanyu-c
Copy link
Member

#8465 duplicate question
cc @edison1105

@github-actions github-actions bot locked and limited conversation to collaborators Sep 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants