Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eliminate use of any type (and consequential eslint suppression) #2

Open
dlh3 opened this issue Jul 6, 2020 · 2 comments
Open

Eliminate use of any type (and consequential eslint suppression) #2

dlh3 opened this issue Jul 6, 2020 · 2 comments
Labels
help wanted Extra attention is needed

Comments

@dlh3
Copy link
Owner

dlh3 commented Jul 6, 2020

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. 😉

@dlh3 dlh3 added the help wanted Extra attention is needed label Jul 6, 2020
@frxncismor
Copy link

How could i run this to debug on console?

@dlh3
Copy link
Owner Author

dlh3 commented Jul 7, 2020

Hola @frxncismor. Thanks for jumping in!

I've added some info in the readme for debugging:
https://github.com/dlh3/react-key-generator#debugging

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.

Muchas gracias!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants