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
This was my first TypeScript project and I'm really struggling with how to deal with types on freeform objects. That is to say, I need to operate on objects that I don't control, so I can't define a tight schema for them.
That's where KeyableObject comes in. I created this interface to represent an object which may or may not have a key property.
I'm not sure if that's the best way to debug a typescript project, but it's the info I found which worked. Another option is to run the Jest tests through an IDE with debugging. I did this using IntelliJ (right-click in a test and click debug), but I imagine WebStorm and VSCode would have similar capabilities.
This was my first TypeScript project and I'm really struggling with how to deal with types on freeform objects. That is to say, I need to operate on objects that I don't control, so I can't define a tight schema for them.
That's where KeyableObject comes in. I created this interface to represent an object which may or may not have a key property.
I was able to avoid
any
almost everywhere, except for in two of the KeyGenerators parameters (actually, in the GeneratorFuncs that the KeyGenerators provide).https://github.com/dlh3/react-key-generator/blob/master/src/keyGenerators.ts#L14-L23
I would appreciate any community help to eliminate those two uses of
any
, and perhaps cleanup the typing in any other ways you see fit.I am hoping I can convince @cwparsons to help out here. 😉
The text was updated successfully, but these errors were encountered: