Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

ts generics

function identity<T>(arg: T): T {    
    return arg;    
}    
let output1 = identity<string>("myString");    
let output2 = identity<number>( 100 );  
console.log(output1);  
console.log(output2);  
Source by www.javatpoint.com #
 
PREVIOUS NEXT
Tagged: #ts #generics
ADD COMMENT
Topic
Name
6+6 =