You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The prop should retain undefined as part of its type definition in both the script and template blocks of a SFC.
What is actually happening?
While the type is correct in the script block, it is not optional in the template block.
This causes a TypeScript error when you try to check if the prop is defined in the template, because TypeScript thinks that the function will never be falsy:
This condition will always return true since this function is always defined. Did you mean to call it instead? ts-plugin(2774)
System Info
No response
Any additional comments?
No response
The text was updated successfully, but these errors were encountered:
Vue version
3.5.12
Link to minimal reproduction
https://play.vuejs.org/#eNp9U12P2jAQ/CvbPIFEE9GqLxQ4VZxQqXpt1T42bWWShfjOsS2vE0An/ns39iG4Izok8rE7Gc+M14/JJ2vTtsFkkkypcNJ6IPSNBSX0dpYnnvJknmt/sAg/nLEEM3jMNUB9WDa6uJnAYAizOZB3Um8/5vrI/8Jo8mCf4Dvpq1vciEZ5GpS4kRoD0zRc54Ph6JJxAo2OoHLEbEOmOxFGwNKZ+qQkLJHGOgNfALiSZQB/b3I9zaI5tsIvHmurhEd+A5hW4+4G0L6VG3YcSfKkKwYAwGezKw9vAjirxlycZhcUyYhTYoUbuU3vyWiOMvgByJPC1FYqdN+tl+whTybRa/xxvMJt0XflPEHSuOdntn0G1KZsFL4CuKd97FqHhK5l7LN+tzFFWMG7Bnu4fyIZ1XTyIo825UsO3Ft0skbthbrFwjjhjQtmrjjpQdqvcr2osHjoBSDdhWVX2iNvUi9GKGV2vw7aV+hl8TQ7q9oa141jzwcb4wpccMCSPKtcCOJhXOklR/9N1Nj/UUPI1DxoS+MWShAtJaqyH8vZGtXiF97eKL/fvGlYx53od6Xkuqv/PtdOiVxta2yUpu6vppKzE+tOxVU7znlliBnPvT/PlHSnOfi80tIyc1YoySH2cHdd8tlWmbVQTHDBHx+PfGLDgfjXoiMeKT4L79MP6fhdcvwPqWZcNQ==
Steps to reproduce
What is expected?
The prop should retain
undefined
as part of its type definition in both thescript
andtemplate
blocks of a SFC.What is actually happening?
While the type is correct in the
script
block, it is not optional in thetemplate
block.This causes a TypeScript error when you try to check if the prop is defined in the template, because TypeScript thinks that the function will never be falsy:
System Info
No response
Any additional comments?
No response
The text was updated successfully, but these errors were encountered: