Look at generic types as a way to have the same function be able to return any type that is passed.
For example, a function that does a get request.
function doGet<T>(endpoint: string): Observable<T> {
return Observable.of(fetch(endpoint));
}
This function will return an observable of type T;
Now, let's say you have a REST api that you can get Posts, Users, Tags. You can use this function with a type definition as such
interface Posts {
//...
}
interface Users {
//...
}
interface Tags {
//...
}
doGet<Posts>('/api/posts') => Observable<Posts>;
doGet<Users>('/api/users') => Observable<Users>;
doGet<Tags>('/api/tags') => Observable<Tags>;
In the example you provide, the Observable that's being passed to the nested function will be of type T that is defined in the generic type.
Hopefully this is clear and answers your question.