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

Feature request: customized component types export #1882

Closed
xiaoxiangmoe opened this issue Sep 17, 2022 · 0 comments
Closed

Feature request: customized component types export #1882

xiaoxiangmoe opened this issue Sep 17, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@xiaoxiangmoe
Copy link
Collaborator

<script lang="ts">
import { defineComponent, ref } from 'vue';
export default (defineComponent({
    setup(props, { expose }) {
        const publicCount = ref(0);
        const privateCount = ref(0);
        expose({ publicCount });
        return { publicCount, privateCount };
    },
}) as any as unknown) as never as new () => {
    $props: {}
    publicCount: number;
};
</script>
<template>
    <div>{{ publicCount }}</div>
    <div>{{ privateCount }}</div>
</template>
<script lang="ts">
import { ref } from 'vue';
export default {} as new () => {
    $props: FooProps;
};
</script>
<script setup lang="ts">
export interface FooProps {
    msg: string;
}
defineProps<FooProps>();
const count = ref(0);
</script>
<template>
    <div>{{ count }}</div>
</template>

Maybe we should allow .vue file user to customized component types export. and this should allow:

  1. using as cast multiple times.
  2. support both script setup and normal component
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant