You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Type '"name"' is not assignable to type 'keyof Person'.
My understanding is that this should be possible; pick() should simply ignore/exclude keys that don't exist in the object. At least, that's the way I've always used it with vanilla JavaScript.
The text was updated successfully, but these errors were encountered:
I understand that the behavior differs from vanilla JavaScript. However, this is intentional in our library. In es-toolkit, our design principle is to provide strict types wherever possible.
If you want to pick properties as shown in the example code, you can cast the property key array to either any[] or Array<keyof Person>.
Consider this example:
This generates the error
My understanding is that this should be possible;
pick()
should simply ignore/exclude keys that don't exist in the object. At least, that's the way I've always used it with vanilla JavaScript.The text was updated successfully, but these errors were encountered: