VueJs how to set prop type to any?

From VueJS docs:

null and undefined values will pass any type validation

Or you can use array and place in it all required types:

propB: [String, Number]

To support props type any when you have props with defined types:

props: {
    custom1: null, // set as `null`
    custom2: undefined,  // or `undefined`
       
    // if you need to add extra rules, simply don't set the `type` prop
    custom3: {
        required: true,
        //... rest of your props
    }
}

DEMO: https://jsfiddle.net/xa91zoyq/4/

Tags:

Vue.Js