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 :is with custom event that overrides native event #333

Closed
jcppman opened this issue Jul 26, 2021 · 2 comments
Closed

Component :is with custom event that overrides native event #333

jcppman opened this issue Jul 26, 2021 · 2 comments
Labels
bug Something isn't working question Further information is requested

Comments

@jcppman
Copy link

jcppman commented Jul 26, 2021

Is this currently supported? if not, what would be the most ideal workaround?

<template>
  <component :is="theComponent" @change="handleChange" />
</template>
<script lang="ts">
import { defineComponent, resolveComponent } from 'vue';

export default defineComponent({
  setup() {
    const theComponent = resolveComponent('custom-component');
    function handleChange(args1: boolean, args2: string) {}
    return {
      theComponent,
      handleChange,
    };
  },
});
</script>

the example above will have warning
type '(args1: boolean, args2: string) => void' is not assignable to type '(payload: Event) => void'

And thanks for the awesome tool!

@johnsoncodehk
Copy link
Member

johnsoncodehk commented Jul 27, 2021

It's supported by some ways in past but not work now, will fix it. Thanks!

@johnsoncodehk johnsoncodehk added bug Something isn't working question Further information is requested labels Jul 27, 2021
@johnsoncodehk
Copy link
Member

Disable type-checking in next version for now, because we don't have a good way to handle this case currently:

<component :is="condition ? Foo : Bar" />

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants