You typed great function but there is a little problem simple - you used B as a parameter name, not type. Use this:
const arr: [string, string][] = [['a', 'b'], ['c', 'd'], ['e', 'f']]
function mapSnd<A, B, C>(arr: [A, B][], f: (second: B) => C): [A, C][] {
return arr.map(row => [row[0], f(row[1])]);
}
const res = mapSnd(arr, second => second.length); // [string, number][]
And for more like mapThrd without separate, there is no way, sorry.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…