Preview:
function ReturnType<T>(val: T ): T {
    return val;
}

const elementstring = ReturnType("hello");
console.log(elementstring.toUpperCase())
console.log(typeof(elementstring))

const elementNumber = ReturnType(1254);
console.log(typeof(elementNumber))
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter