So I'm a bit confused about generics. I have an in...
# getting-started
m
So I'm a bit confused about generics. I have an interface like this:
Copy code
interface IterableResponse {

    val data: List<T>
    val paginationInfo: More?
}
and I am getting an error "Unresolved reference T". I would like for any class that implements the interface to have a
data
property that is a list of anything - but I don't want to use
List<Any>
because I need the implementing classes to have typed Lists. Am I using generics incorrectly? What am I doing wrong?
k
You need to pass T in your interface:
Copy code
interface IterableResponse<T> {

    val data: List<T>
    val paginationInfo: More?
}
m
Ahh, got it. Thank you 🙂
h
Type Parameters get hard to keep track of in a hurry. Feel free to DM me if you have further questions
👍 1
m
Thanks @Hullaballoonatic, I appreciate it!