JavaScript’s syntax and type system are highly permissive.

Variables do not require explicit type declarations, so implicit conversions at runtime can cause unexpected errors without the developer noticing.

Because JavaScript is dynamically typed, these bugs can be difficult to find. TypeScript helps prevent them by reporting type errors during compilation.

Unlike JavaScript, TypeScript performs type checking.

It checks code using both explicit and inferred types.

It checks the types of variables, functions, and objects, and reports mismatches during compilation.

interface human {
  name: string;
  age: number;
}

const human: Person = { name: "steve", age: 17 };

If this is TypeScript code, it becomes the following after compilation:

const human = { name: "steve", age: 17 };

This is how it is converted into JavaScript code.

TypeScript offers advantages in safety, productivity, and maintainability.