1

Snip of components/Employees.vue

<script>
import Vue from 'vue';

export default Vue.extend({
    props: ['employees', 'filter', 'fields_employee', 'selected'],
    computed: {
        filteredEmployees() {
            return this.employees.filter(this.filter);
        }
    },
    methods: {
        itemSelected(item: any) {
            this.$emit('itemSelected', item);
        }
    }
});
</script>

which produces the following error

Employees.vue: Unexpected token, expected "," (30:25)

  28 |     },
  29 |     methods: {
> 30 |         itemSelected(item: any) {
     |                          ^
  31 |             this.$emit('itemSelected', item);
  32 |         }
  33 |     }

My main view is using TypeScript without issues, but it looks like this file isn't being recognized properly. My tsconfig.json should be capturing the file properly

"include": [
  "src/**/*.ts",
  "src/**/*.tsx",
  "src/**/*.vue",
  "tests/**/*.ts",
  "tests/**/*.tsx"
],

1 Answer 1

1

The issue is a result of forgetting to explicitly specify TypeScript for the script tag:

<script lang="ts">

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.