-2

So I'm passing in components and properties dynamically along these lines (the idea is to 'stack-up' various components that I'll advance through)

Anyway, I've declared some properties on one of my 'stacked' components with their types as:

  props: {
    pk: String,
    successUrl: String,
    cancelUrl: String,
    shippingAddressCollection: Boolean,
  },

However, when it's created, the component complains that my shippingAddressCollection does not have the expected type, which is:

Invalid prop: type check failed for prop "shippingAddressCollection". Expected Object, got Boolean with value false.

It's expecting an object instead of a boolean. How can this be?

Phil
  • 157,677
  • 23
  • 242
  • 245
donny-nyc
  • 21
  • 6
  • 1
    You should check first what kind of data you're passing to the prop. If in your component you are passing an object like `shippingAddressCollection = '{ someProperty: 'Some value'} ', Vue is expecting your declared prop to be an object, not a boolean. – Franco Alemandi Jul 19 '21 at 00:41
  • I can't reproduce this at all ~ https://jsfiddle.net/9kp5wa1c/. Are you absolutely sure of your prop definitions? – Phil Jul 19 '21 at 00:51
  • Yes. I'm assuming it's something to do with how I'm passing in the properties dynamically. – donny-nyc Jul 19 '21 at 00:58
  • It can't be. The error message is literally telling you that your prop definition has `shippingAddressCollection: Object` or the equivalent of that – Phil Jul 19 '21 at 00:59
  • Would you show us the component from where you're passing the prop? – Franco Alemandi Jul 19 '21 at 01:00

1 Answers1

-1

The prop validation error is being thrown by @vue-stripe, not the component, like I'd assumed.

shippingAddressCollection is expected to be an object (see the Props section under Getting Started).

But like the error says, it's being given a Boolean value. shippingAddressCollection should be a configuration object. It's not a simple Boolean flag indicating whether or not to request the shipping address.

donny-nyc
  • 21
  • 6