Functional TypeScript
Victor Savkin

Excellent functional refactoring, Victor.

One bit of non-generic code remains:

type Predicate = (e: Employee) => boolean;

This infects and(), making it non-generic.

Easy to fix:

type Predicate<T> = (value: T) => boolean;

function and<T>(predicates: Predicate<T>[]): Predicate<T> { …

function filteredSalaries(employees: Employee[], conditions: Predicate<Employee>[]): number[] { …

I collected the code in a single gist with my tweaks:

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.