-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
An error occurred when using defineProps<>. #4982
Comments
duplicate of #4294 |
look: #4294 (comment) You can declare SampleProps in app.vue <script lang='ts'>
export interface SampleProps{
sample1?:string;
sample2?:string;
}
</script>
<script setup lang="ts">
import { ref } from 'vue'
import SampleProps from './SampleProps'
const props = withDefaults(defineProps<SampleProps>(),{
sample1:'sample'
});
</script>
<template>
<h1>{{ props }}</h1>
</template> |
@ygj6 Okay, I got it. I was told it might be supported later. May I know the schedule? |
7 tasks
Has it been fixed? I meet the same problem @v3.2.13 |
no. I know it's not supported yet.
…-----Original Message-----
From: ***@***.***>
To: ***@***.***>;
Cc: ***@***.***>; ***@***.***>;
Sent: 2022-03-27 (일) 16:06:49 (GMT+09:00)
Subject: Re: [vuejs/core] An error occurred when using defineProps<>. (Issue #4982)
duplicate of #4294
Has it been fixed? I meet the same problem @v3.2.13
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Version
3.2.22
Reproduction link
sfc.vuejs.org/
Steps to reproduce
Create one interface file with typescript type.
Import the file from the component(. vue) that definesProps.
Define props as follows.
import type { GroupTitleLargePageData, GroupTitleLargeProps } from "@/interfaces/components/groups/GroupTitleLargePageTypes";
const props = withDefaults(defineProps(),{});
------------------- error ----------------------------
[plugin:vite:vue] [@vue/compiler-sfc] type argument passed to defineProps() must be a literal type, or a reference to an interface or literal type.
D:/project/hamonica/workspace/hamonica-fe-type/src/components/groups/GroupTitleLarge.vu
14 | const props = withDefaults(defineProps(),{});
| ^^^^^^^^^^^^^^^^^^^^
What is expected?
I want to call and use the props interface through import.
What is actually happening?
------------------- error ----------------------------
[plugin:vite:vue] [@vue/compiler-sfc] type argument passed to defineProps() must be a literal type, or a reference to an interface or literal type.
D:/project/hamonica/workspace/hamonica-fe-type/src/components/groups/GroupTitleLarge.vu
14 | const props = withDefaults(defineProps(),{});
| ^^^^^^^^^^^^^^^^^^^^
i use vite + typescript
The text was updated successfully, but these errors were encountered: