which is used to infer the type of an arbitrary expression like as const, but not throwing errors when this can't be done. For example, ("1" + "2") as const will be an error, but __VLS_tryAsConstant("1" + "2") will just be of type string.
btw, I think __VLS_tryAsConstant can be used in other places to provide more precise type info - but it may cause performance issues.
fix #4668.
Introduced a new helper:
which is used to infer the type of an arbitrary expression like
as const
, but not throwing errors when this can't be done. For example,("1" + "2") as const
will be an error, but__VLS_tryAsConstant("1" + "2")
will just be of typestring
.btw, I think
__VLS_tryAsConstant
can be used in other places to provide more precise type info - but it may cause performance issues.