TypeScript Basics for QA

TS Fundamentals for Automation

TypeScript ensures your tests don't break due to simple typos.

1. Types & Interfaces

typescript

interface User {

id: number;

name: string;

}

const user: User = { id: 1, name: 'vishvas' };

2. Conditionals

typescript

if (user.id === 1) {

await page.click('#admin-btn');

}

3. Arrays & Loops

typescript

const items: string[] = ['Apple', 'Banana'];

for (const item of items) {

console.log(`Checking ${item}`);

}

    CareerRaah - AI Learning Platform for Professionals