Subscribe on changes!

Text interpolation doesn't support arrow function return type in TypeScript

avatar
Jul 29th 2022

Vue version

3.2.37

Link to minimal reproduction

https://stackblitz.com/edit/vitejs-vite-nqcpma?file=src%2FApp.vue&terminal=dev https://sfc.vuejs.org/#eNp9Us1OwzAMfhWTS1eJtWLH0k1w4w245BI6r8vU/ChxB6jqu+N23To2RA5RPvuz/Tl2J169z44tikKUsQraE0Sk1kOjbL2WgqIUG2m18S4QdBBwBz3sgjOQcFgirbQA0lbORgLCL3qC9cAqIwVt680i0VApC9WeE2KSPl9zVzdcKUZyQhNdiplvYn2b+Q2bxsG7C832IUmlLfNTCyyYAaHxjSJkBHzKrT5OTwba+pagOKqmxaHNQbgU8DLa2bDAFNYbWJw7woxUqJGyMSJlan5J1nVT430/lcrnWn+UPSP4XX8lxey5ElKAst/peP8v6Rx9p2x1p6zML78jHsVpukujfHaIzvIudONUJwevQAGjZbDx1AcsxZ7IxyLP464aNugQMxfqnF9ZaC1pgxlGs/wI7jNi4MQngSykF/0PsYfKiA==

Steps to reproduce

image

What is expected?

arrow function return type should be correct parsed in vue template

What is actually happening?

In the demo code above, when annotating the return type in the arrow function, the dist build results in an empty function.

@input="(e: any): any => (text1 = e.target.value)"
"

// with return type
onInput: _cache[1] || (_cache[1] = ($event) => ((e) => (text1.value = e.target.value)))

// without return type
onInput: _cache[0] || (_cache[0] = (e) => (text1.value = e.target.value))

System Info

No response

Any additional comments?

No response