Skip to content

.def() doesn't work #12

@MatteoGabriele

Description

@MatteoGabriele

Hi, I'm having some troubles declaring default values in my shape

in this example i'm expecting the theme property to be #E58005 if the object doesn't contain that property, instead my object contains only the properties I add.

import type from 'vue-types'

export default type.shape({
  author: type.string.isRequired,
  text: type.string.isRequired,
  theme: type.string.def('#E58005')
})

if I receive this object as a prop of my component

{
 author: 'matteogabriele',
 text: 'lorem ipsum'
}

I'm expecting this

{
 author: 'matteogabriele',
 text: 'lorem ipsum',
 theme: '#E58005'
}

thanks for your time, love this package! :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions