Tycho Grouwstra I can only assume that I am missing something regarding Array.prototype.map as the following works as expected.

interface Complex {
x: number;
text: string;
}
const numbers = [0, 1, 2, 3];const double = (x: number) => x * 2;
const hello = (x: number) => `Hello ${x.toString()}`;
const complex = (x: number): Complex => ({
x,
text: `Hello ${x.toString()}`,
});
const a = numbers.map(double);
const b = numbers.map(hello);
const c = numbers.map(complex);

Specifically, c is an array of Complex.

Can you provide some specific examples of what the specific code in JavaScript that cannot be typed in TypeScript?

BTW… Will concede that some super functional patterns are going to be super hard. For example, I spent about an hour trying to figure out what a transducer is so that I could type it. Ended up concluding anything that takes me an hour+ to figure out is likely too complicated a pattern for me to use in a real project and decided to stop trying.

Broad infrastructure, development, and soft-skill background

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store