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

setup interface Props transfrom dismiss #182

Closed
3 tasks done
Miofly opened this issue Feb 24, 2023 · 2 comments
Closed
3 tasks done

setup interface Props transfrom dismiss #182

Miofly opened this issue Feb 24, 2023 · 2 comments

Comments

@Miofly
Copy link

Miofly commented Feb 24, 2023

Describe the bug

when i use unplugin-vue-macros/vite i can import props in external files,but build error

<script setup lang="ts">
import type { TestProps } from './props';

const {
	name, type
} = defineProps<TestProps>();
</script>

<template>
	<div>
		name:{{ name }}
		type:{{ type }}
	</div>
</template>

<style scoped lang="scss">

</style>

Reproduction

as example

Steps to reproduce

pnpm build-ts

System Info

null

Validations

@qmhc
Copy link
Owner

qmhc commented Feb 24, 2023

Infer ts intersection types is not a normalize feature of vue, see vuejs/core#4294 and vuejs/core#7394. (the PR of this feature is ready to merge, maybe come soon)

unplugin-vue-macros implements this via a inner plugin, but it will lose types definition of props when transform. (and I don't know whether the official implementation will also is it)

So, I think you'd better use the js props or literal props type currently. And we keep this issue open to track the progress.

@Miofly
Copy link
Author

Miofly commented May 22, 2023

vue3.3 is publish, unplugin-vue-macros/vite whether the relevant function can be supported,exp

const ns = /* hoist-static*/ useNamespace('logo');

defineOptions({
	name: ns.b()
});

when i use unplugin-vue-macros/vite hoistStatic: true build error

@Miofly Miofly closed this as completed Jun 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants