Here's a method that I have:
getFiveObjectsFromArray(array: T[]) {
return array.slice(0, 5);
}
I've been using this method multiple times. Is there a way in TypeScript to pass a generic argument instead of using multiple types?
Also, when I try to use the parameter 'T', I encounter this error message:
"TS7006: Parameter 'T' implicitly has an 'any' type."