Skip to content

Cannot use data properties in script when using Vue.extend #82

@Cy-Tek

Description

@Cy-Tek

Describe the bug
When I have a template that is not using the class style of component, the parser complains about accessing data from either methods or computed properties. It does not complain when I convert the template to using vue-property-decorator

To Reproduce
Steps to reproduce the behavior:

  1. Make a component with a script section like
    <script lang="ts">
    import Vue from 'vue'
    
    export default Vue.extend({
      name: 'Test',
      data() {
        return {
          str: 'Hello world'
        }
      },
      computed: {
        getStr(): string {
          return this.str
        }
      }
    })
    </script>
  2. Run nuxt-ts dev
  3. See error

Expected behavior
I should be able to access the properties on data from either the computed or methods properties without using vue-property-decorator

Screenshots
Example:
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions