Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Computed property "Parsing error: '}' expected at "

I am setting a computed property in my Vue component using typescript to define a return type and eslint is giving me an error. Any ideas on what is going on? The application runs as expected

I have attempted removing the typing or setting a get() associated however the problem persists no matter the formatting.

presets():Array<Iperf>{
    return this.$store.state.presets.iperf
}

The expected results should be no error, however the actual result is:

Module Warning (from ./node_modules/eslint-loader/index.js):
error: Parsing error: '}' expected at src\views\Iperf.view.vue:58:17:
  56 |     },
  57 |     computed: {
> 58 |         presets():Array<Iperf>{
     |                 ^
  59 |             return this.$store.state.presets.iperf
  60 |         }
  61 |     }
like image 280
BlueFrog Avatar asked Jun 03 '26 02:06

BlueFrog


1 Answers

I figured out that ESLINT was trying to parse my TypeScript as JSX. So I fixed some formatting.

Cannot use: iperf:<Iperf>{}

Use insetad: iperf: {} as Iperf

like image 142
BlueFrog Avatar answered Jun 05 '26 01:06

BlueFrog