score:1

Accepted answer
type ItemStringsOnly = Pick<Item, { 
    [K in keyof Item]: Item[K] extends string ? K : never 
}[keyof Item]>;

export function sortList(list: ListItems, sortKey: keyof ItemStringsOnly): ListItems {
    return list.sort((a, b) => a[sortKey].localeCompare(b[sortKey]));
}

Related Query

More Query from same tag