ts-toolbelt icon indicating copy to clipboard operation
ts-toolbelt copied to clipboard

`AutoPath` doesn't error on non-existent property

Open nkalpak opened this issue 3 years ago • 5 comments

🐞 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

nkalpak avatar Apr 11 '21 05:04 nkalpak

Thanks for reporting this. I should add a check on undefined values.

millsp avatar Apr 12 '21 19:04 millsp

Actually, if you rollback to version 9.3.10 it works as expected. (You can check it in the codesandbox from above)

jessetabak avatar Apr 21 '21 06:04 jessetabak

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.

stale[bot] avatar Jun 20 '21 13:06 stale[bot]

Bad bot.

OmgImAlexis avatar Jun 29 '21 03:06 OmgImAlexis

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.

omerman avatar Dec 09 '21 23:12 omerman