Translating JavaScript to TypeScript. Added base response types (e.g. HTMLPage).