A keypath type utility from one of my projects for this question on SO: https://stackoverflow.com/questions/77870138/recursive-type-needs-to-avoid-excessively-deep
See the types and some functions for them in the src
dir. The tests are in tests
- you can run them with npm run tests:types
for types and with npm run tests:regular
for actual functions.