ts-toolbelt
ts-toolbelt copied to clipboard
`AutoPath` doesn't error on non-existent property
🐞 Bug Report
Describe the bug
The documentation for AutoPath
provides two use-cases that should work, and two that should error.
The two use-cases that should produce a type error, don't do so.
I have also tried passing a completely bogus, non-dotted path (line 35 in the sandbox), and there is no error produced (is this working as intended? should AutoPath
only work with dotted paths?).
Reproduce the bug
https://codesandbox.io/s/peaceful-leftpad-lbwbg?file=/src/index.ts
Check lines 31, 32, 35
Expected behavior
AutoPath
should produce a type error
Thanks for reporting this. I should add a check on undefined
values.
Actually, if you rollback to version 9.3.10 it works as expected. (You can check it in the codesandbox from above)
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Bad bot.
This is a duplication for https://github.com/millsp/ts-toolbelt/issues/276
If you will change the User
type name
field to be number, like such:
https://codesandbox.io/s/practical-wildflower-8uegn?file=/src/index.ts
It will work properly.