You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
NestJS_Basic/ts_playground/05-generics.ts

9 lines
193 B

function wrapInArray<T>(value: T): T[] {
return [value];
}
const numArray = wrapInArray(123);
const strArray = wrapInArray("NestJS");
console.log(numArray);
console.log(strArray);