bajankristof / nedb-promises

A dead-simple promise wrapper for nedb.
MIT License
298 stars 45 forks source link

move generic to class level #53

Closed ncharris93 closed 2 years ago

ncharris93 commented 2 years ago

This change moves the generic type to the class level & create function.

This change is useful because you can add types from a Factory function.

I don't think there will be an edge case where you'd want to pass different types to different functions on the same Datastore.

This is how I'm using this package, and thought others might find it useful too.

bajankristof commented 2 years ago

Thanks for the contribution!

I thought about this as this would be kind of a breaking change for people using the package with TypeScript. In the end I came to the conclusion not to go in this direction. As much as I agree that most people probably use the datastore this way I wouldn't like to close the door on others who might need the flexibility. I'm leaving the PR open for now, if it gets a lot of upvotes in the coming month I might reconsider it, if it doesn't I will close the PR. I hope that makes sense and sounds reasonable. Anyway, thanks again for opening this PR.

ncharris93 commented 2 years ago

I'm using it with TS and I was using a different fork of This repo that used the types this way. That repo hasn't had a change in 2 years so I figured I'd make the change here cause your repo is maintained :)

I definitely understand not wanting to add anything that'll break others implementations.

Thanks for your feedback

stale[bot] commented 2 years ago

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.