Geralmente fazemos assim.
interface Props<T> {
items: T;
}
function select<T>({ items }: Props<T>) {
return {
// ...
};
}
const select2 = <T>({items}: Props<T>) => {
return {
// ...
};
}
select<[{id: number}]>({items: [{id: 1}]})
select2<[{id: string}]>({items: [{id: '1'}]})
Sendo o select -> function select<[{ id: number; }]>({ items }: Props<[{ id: number; }]>): {}
Sendo o select2 -> const select2: <[{ id: string; }]>({ items }: Props<[{ id: string; }]>) => {}