3 ms·
Here is a case were object parameters aren't the better choice: type TBinarySearchParams<T> = { needle: T; haystack: [T]; }; const
by Joker_vD 2y ago
Here is a case were object parameters aren't the better choice:
type TBinarySearchParams<T> = {
needle: T;
haystack: [T];
};
const binarySearch = <T,>(args: TBinarySearchParams<T>) => { ... }
binarySearch({needle: 42, haystack: [1,2,3]});
Or at least, I would argue they are not better, but if you still insist:
type TIsEvenParams = {
num: number;
};
const isEven = (args: TIsEvenParams) => { ... }
isEven({num: 7});
Surely that is strictly worse?