Closed Rock070 closed 10 months ago
I think that we've discussed this before. Currently the only way would be:
const props = defineProps<{
title?: Ref<string> | string
}>()
or using patchOptions
, for example:
const { patchOptions } = useModal({
component: ...,
attrs: {
title: 'first'
}
})
patchOptions({
attrs: {
title: 'changed title'
}
})
Version
vue-final-modal: 4.4.5 vue: 3.3.4
OS
Mac
Reproduction Link
https://stackblitz.com/edit/github-p51t7c?file=src%2Fcomponents%2FMyModalPreview.vue
Steps to reproduce
npx vue-tsc
What is Expected?
expect type check pass
What is actually happening?
type check fail as follows
Description
Hi there,
I encountered an issue while using the
useModal
function in Vue when passing aRef
object as props using theattrs
parameter. The TypeScript check withnpx vue-tsc
throws an error as follows:Here's the relevant code:
myModal.ts
myModalPreview.ts
I noticed that if I use
reactive
to wrap theattrs
object, the error no longer occurs:I'm not sure if this is a bug or intended behavior. I would appreciate some clarification on why this happens and whether my workaround is the correct approach.
Thanks!