Missing support in @vue/runtime-dom
for TypeScript's --exactOptionalPropertyTypes
option
#6068
Labels
@vue/runtime-dom
for TypeScript's --exactOptionalPropertyTypes
option
#6068
Vue version
3.2.36
Link to minimal reproduction
https://stackblitz.com/edit/vitejs-vite-hguguz?file=tsconfig.json,src%2FApp.vue&terminal=dev
Steps to reproduce
vue-tsc --noEmit
What is expected?
The command
vue-tsc --noEmit
runs without errors.What is actually happening?
The command
vue-tsc --noEmit
gives type errors (output below was copied from StackBlitz reproduction):System Info
No response
Any additional comments?
TypeScript 4.4 introduced a new option
--exactOptionalPropertyTypes
which specifies that optional property types should be interpreted exactly as written, meaning that| undefined
is not added to the type.The
*HTMLAttributes
interfaces in@vue/runtime-dom
are lacking the| undefined
type, meaning thatvue-tsc
with enabled--exactOptionalPropertyTypes
flag will fail.Regarding the StackBlitz reproduction, the
ImgHTMLAttributes
interface should be defined at least asinstead of
However, for sake of completion the
| undefined
type needs to be added to all optional properties, not only thealt?
one.The text was updated successfully, but these errors were encountered: