If in a typedef

how would I declare such a type in haxe?

export declare type FormikTouched<Values> = {
    [K in keyof Values]?: Values[K] extends object ? FormikTouched<Values[K]> : boolean;
};

Short answer: typedef FormikTouched = Dynamic

Slightly longer answer: with a const type parameter and a genericMacro building fields from it.

I think it is in most cases better to use the Any type instead of Dynamic

I think it is one of the other cases here, though.

If I understand correctly, the ? in [K in keyof Values]?: means the fields are optional, so you could have to write something like this:

var a:FormikTouched<Whatever> = {};
a.whatever = true;

Which would not work with Any.