Skip to main content

All Questions

Tagged with
0 votes
1 answer
45 views

Binding multiple properties to a component using and object as props - Vue 3

I'm having a little problem binding multiple properties to a component using an object. When I use this component on any other page I expect to pass the props in matching the ContentOptions interface ...
bricewa's user avatar
  • 75
0 votes
0 answers
61 views

Vue 3: withDefaults() prevent TypeScript from checking conditional props

I've tried to create conditional props for my <Button /> component using discriminated union types. I don't want to allow pass down props like to, hash, linkBehavior when another prop called ...
Frank_Cheynne's user avatar
0 votes
1 answer
43 views

In Vue3's compositional API, how can I v-bind a dynamic group of props to a child component and not lose reactivity?

The context is that I have a Button component and a SquareButton component that wraps it as a higher order component. The SquareButton takes the same props as Button, but includes an extra prop needed ...
rescuecreative's user avatar
0 votes
0 answers
140 views

Prop with default value gets undefined type in Vue 2

I have a child component with code: export default { props: { search: { type: String, default: () => null, }, } } And a parent component with code: <template> <ChildComponent ...
blackkk68's user avatar
0 votes
1 answer
217 views

Nuxt3 typescript props possibly undefined ! how to correctly declare component props using custom types?

I am trying to use typescript for a Nuxt3 project and it is my first experience with Typescript. I have this component that aims at creating or editing a person in the backend: <template> <...
Meaulnes's user avatar
  • 475
0 votes
1 answer
397 views

How to set default value on complex prop using Vue's Type-based props declarations

I can't get around this error: Argument of type 'HelloWorldProps' is not assignable to parameter of type 'InferDefaults<LooseRequired<HelloWorldProps>>'. Types of property 'complexProp' ...
MisterIsaak's user avatar
  • 3,902
3 votes
2 answers
1k views

Errors typing props using interface in Vue 3 (Vue: Untyped function calls may not accept type arguments.)

I want to type props using an interface, this is my code and works correctly. But: defineProps<Props>(); Is highlighted with this error (Vue: Untyped function calls may not accept type ...
Angel Martinez's user avatar
-1 votes
1 answer
149 views

Vue composition typescript access props value in another props validation

i would want to access the props value from another props validator. Here is my code: <script lang="ts" setup> import { PropType } from 'vue'; import { iStep } from '@/...
user3699170's user avatar
1 vote
2 answers
3k views

Why is there a "No overload matches this call" error when passing a reactive prop?

In my main application I defined import { DateTime } from "luxon" const now = ref(DateTime.now()) const maxCityNameSize = ref(0) The variables are then passed to a component: <time-bar :...
WoJ's user avatar
  • 29.2k
0 votes
1 answer
82 views

Type disabled problem in WebStorm about Vue3 Props

declare Props import { ExtractPropTypes, PropType } from 'vue' export const Props = { ocrName: { type: String as PropType<string>, default: () => 'Nicky', }, age: { type: ...
卢方舟's user avatar
0 votes
2 answers
241 views

Vue props become optional when using Object.assign to merge multiple prop definitions in defineProps

I use a const MODAL_OPTION_PROP to define common props for modal as below: export const MODAL_OPTION_PROP = { modalOption: { type: Object as PropType<ModalOptionParams>, default: ...
Sibevin Wang's user avatar
  • 4,508
0 votes
1 answer
363 views

How to prevent the mutation of nested prop fields in Vue 3, using TypeScript?

Suppose I have the following SFC component: <script setup lang="ts"> export interface Person { name: string; } const props = defineProps<{ person: Person; }>(); function ...
rodrigocfd's user avatar
  • 7,481
0 votes
2 answers
991 views

What is the best practice to pass null to a required props in component in vuejs?

Stack: vuejs (3.2) + composition API + Typescript + Visual studio code file type.ts: export class GeographicCoordinate { latitude: number; longitude: number; altitude?: number; constructor(...
timewalker's user avatar
1 vote
1 answer
1k views

Why vue.js type check for props failed even I use "Object as PropType<GeographicCoordinate | null>"?

Context: vue.js (^3.2.13) + Typescript + Composition API + visual studio code file type.ts: export class GeographicCoordinate { latitude: number; longitude: number; altitude?: number; ...
timewalker's user avatar
1 vote
1 answer
1k views

Vue3 shared props between components

I've recently switched from Vue2 to Vue3 but I'm sort of confused to what the best practice is to shared props between multiple components. I want to make input components which share the common props ...
Reflexecute's user avatar

15 30 50 per page