Skip to content

Cannot read property isLoose of undefined when using loose shape #5

@EyMaddis

Description

@EyMaddis

First off, great library!

The problem is, that .shape().loose is not applicable with the latest version of Vue.
in this line this is undefined: https://github.com/dwightjack/vue-types/blob/master/src/index.js#L215

Here is the property validation of Vue:
https://github.com/vuejs/vue/blob/01151ce3fa3cb346443d086332ec053c389ee619/src/core/util/props.js#L123

The this context is lost, because the validator function gets called as validator(), not prop.validator.

I am not sure how to fix this using the isLoose flag. A possible workaround is to use isLoose as a second parameter or by introducing looseShape({}).

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