TypeScript is a strongly-typed superset of JavaScript that adds optional static types checked at compile time, then compiles down to plain JavaScript. All valid JS is valid TS.
TypeScript catches type errors before the code runs — typos, wrong argument types, null access — which is why modern automation frameworks (Playwright, Cypress, WebdriverIO) default to it. Types give editor autocomplete, safer refactoring, and self-documenting APIs (a Page Object method signature tells you exactly what it needs). The type system exists only at compile time; the compiler (tsc) strips types and emits JavaScript, so there is zero runtime type checking unless you add it. For testers, TypeScript means fewer 'undefined is not a function' failures in test code and confident refactors across large suites.
A Page Object method typed as login(user: string, password: string): Promise<void> makes the editor flag a call that forgets the password or passes a number — a bug caught before the test ever runs.
In an interview: 'TypeScript adds type safety — does that mean it validates types when the test runs?'