Check out example codes for "extend generics in functions typescript". It will help you in understanding the concepts better.

Code Example 1

interface Lengthwise {
    length: number;
}

function loggingIdentity<T extends Lengthwise>(arg: T): T {
    console.log(arg.length);  // Now we know it has a .length property, so no more error
    return arg;
}

Learn ReactJs, React Native from akashmittal.com