router utils for TypeScript, plus tests