Subscribe on changes!

template compiler support Non-empty operator

avatar
Aug 20th 2021

What problem does this feature solve?

I defined an optional array in the ts.d file, when I need to render an item, it will be judged based on the length of the array.

item v-if="car.trackPoints!.length" If don't add the middle exclamation operator, it will prompt ts(2532) err, but the code can run normally

After adding the! Operator, ts(2532) disappears, but it will prompt [plugin:vite:vue] Error parsing JavaScript expression: Unexpected token, expected ","

What does the proposed API look like?

item v-if="car.trackPoints!.length"