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

TypeScript Types #18

Open
stropho opened this issue Aug 20, 2021 · 2 comments · May be fixed by #20
Open

TypeScript Types #18

stropho opened this issue Aug 20, 2021 · 2 comments · May be fixed by #20

Comments

@stropho
Copy link

stropho commented Aug 20, 2021

Hello I was wondering, if it is possible to add some Typescript types to make it a bit easier to work with this library in a typescript project (or even just for type hinting in an IDE)

I'm not looking for strong types for everything (but I mean why not :-D ) , but rather for some convenience helper types.
For example

const staticReducer = {
	foo: (state: 'foo', action) => state,
	nested: { bar: (state: 'bar', action) => state },
}

type State = StateFromDeepReducersMapObject<typeof staticReducer>

I already have a few of these and I'm willing to do a PR.
I'm also a bit afraid that once some types are added, all the exported members from the library have to be (to some extent) typed in order to be able to use them in TS project.
Sooo, I'm not saying I'm going to prepare a PR tomorrow but it could be soon enough. As long as I know somebody will have a look and possibly merge it 😉

@GuillaumeCisco
Copy link
Owner

Could be great, yes.
But I'm not a fan of typescript.
It has far more cons than pros to me. Especially it breaks introspection in IDE.
And this does not replace tests.

You can create a PR and I will let you know if it is not breaking anything in a development tools confort.

Thank you,

@stropho
Copy link
Author

stropho commented Aug 20, 2021

Yup, I'm aware about some cons, and I know it doesn't replace tests. Not that this library has too many of them :-D
It is all connected to what project you are working with and where you want to use the (un)typed libs
I don't want change any of the source code here. Just add a file or 2.

@stropho stropho linked a pull request Aug 27, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants