Subscribe on changes!

`null` binding value triggers type error in DOM attributes

avatar
Jun 18th 2023

Vue version

3.3.4

Link to minimal reproduction

https://stackblitz.com/edit/vitejs-vite-pxbnfc?file=src%2FApp.vue

Steps to reproduce

This issue reproduces with Volar (Vue Language Features) only but since this is about types shipped with Vue, I'm taking a shot at reporting it here.

An element with a native DOM attribute (for example aria attribute but it could be style or many other) whose binding value is set to null results in Volar reporting a type issue.

What is expected?

No type issues - null seems to be supported the same way as undefined at runtime and should result in the attribute being omitted.

What is actually happening?

Volar reports a type issue because null value is not allowed.

Screenshot 2023-06-19 at 00 02 31

System Info

No response

Any additional comments?

No response