The issue is that in the Subpath type we exclude all of the properties of an array, which includes the length property, this results in foo.length being excluded even though in this case length is a property on an object. One way to fix this is to change the exclusion to only apply if the type is an array:
The issue is that in the
Subpath
type we exclude all of the properties of an array, which includes thelength
property, this results infoo.length
being excluded even though in this caselength
is a property on an object. One way to fix this is to change the exclusion to only apply if the type is an array:Here's the TS playground.