adding definitions and hacks to make frontend.ts typecheck cleanly