That gets closer to the problem, but the solution is further away. You don't want to return "Functor" (which is like a vtable, the interface itself) but instead the thing itself which is implementing the Functor interface.
So you end up with
interface Functor<A> {
map<B>(f: (a: A) => A): Self<B>
}
where `Self` needs to recognize that the type being defined to implement this interface has a "slot". This tends to make things tough.
So you end up with
where `Self` needs to recognize that the type being defined to implement this interface has a "slot". This tends to make things tough.