Skip to content
This repository was archived by the owner on Mar 8, 2019. It is now read-only.
This repository was archived by the owner on Mar 8, 2019. It is now read-only.

Cannot parse components with data using vue-property-decorator #76

@JessicaSachs

Description

@JessicaSachs

This is a blocker to using vue-property-decorator (my apologies for not catching this in the other issue!)

If you have a component that has any data without a decorator (which is how you declare data in vue-property-decorator), vue-docgen-api can't handle it.

An example component AppButton.vue

<script>
import { Vue, Prop, Component } from 'vue-property-decorator';
export default AppButton extends Vue {
    someData = 'my wonderful data';
}
</script>

Will throw the below stacktrace.... It seems that the error is mainly coming from vue-docgen-api's classPropHandler.js

TypeError: Cannot read property 'length' of undefined
    at NodePath.each (/Users/jessicasachs/projects/design-sys/node_modules/ast-types/lib/path.js:84:30)
    at NodePath.filter (/Users/jessicasachs/projects/design-sys/node_modules/ast-types/lib/path.js:119:14)
    at /Users/jessicasachs/projects/design-sys/node_modules/vue-docgen-api/dist/script-handlers/classPropHandler.js:16:63
    at Array.forEach (<anonymous>)
    at propHandler (/Users/jessicasachs/projects/design-sys/node_modules/vue-docgen-api/dist/script-handlers/classPropHandler.js:15:14)
    at /Users/jessicasachs/projects/design-sys/node_modules/vue-docgen-api/dist/parse-script.js:26:59
    at Array.forEach (<anonymous>)
    at /Users/jessicasachs/projects/design-sys/node_modules/vue-docgen-api/dist/parse-script.js:26:23
    at Array.forEach (<anonymous>)
    at executeHandlers (/Users/jessicasachs/projects/design-sys/node_modules/vue-docgen-api/dist/parse-script.js:25:33)
    at Object.parseScript [as default] (/Users/jessicasachs/projects/design-sys/node_modules/vue-docgen-api/dist/parse-script.js:21:5)
    at parseSource (/Users/jessicasachs/projects/design-sys/node_modules/vue-docgen-api/dist/parse.js:45:31)
    at Object.parseFile (/Users/jessicasachs/projects/design-sys/node_modules/vue-docgen-api/dist/parse.js:21:12)
    at Object.parse (/Users/jessicasachs/projects/design-sys/node_modules/vue-docgen-api/dist/main.js:9:13)
    at defaultParser (/Users/jessicasachs/projects/design-sys/node_modules/vue-styleguidist/loaders/vuedoc-loader.js:23:40)
    at Object.module.exports (/Users/jessicasachs/projects/design-sys/node_modules/vue-styleguidist/loaders/vuedoc-loader.js:28:10)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions