Plugin middleware setup in typescript

Something fishy here