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

Support Immutable's List with ListDataprovider, ListBaseDataProvider #499

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

black7375
Copy link

@black7375 black7375 commented May 24, 2020

Made to support List<T> type of Immutable.js. #498
(See ListDataProvider, ListBaseDataProvider)
https://github.com/black7375/recyclerlistview/blob/master/src/core/dependencies/DataProvider.ts

Precautions

@black7375
Copy link
Author

black7375 commented May 24, 2020

What do you think about using generic instead of any type?

https://www.typescriptlang.org/docs/handbook/generics.html#hello-world-of-generics

While using any is certainly generic in that it will cause the function to accept any and all types for the type of arg, we actually are losing the information about what that type was when the function returns. If we passed in a number, the only information we have is that any type could be returned.

Instead, we need a way of capturing the type of the argument in such a way that we can also use it to denote what is being returned. Here, we will use a type variable, a special kind of variable that works on types rather than values.

Generic can be guaranteed to be of the same type.

I think it's better, but I'm not sure that the maintainer will accept the PR, so I followed the existing API.

Copy link

@n0mer n0mer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

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 this pull request may close these issues.

3 participants