gyanguide interview materials
typeScript

Difference between Implicit and Explicit Data Type

In Type Theory and languages like TypeScript, Basic Explicit Types means you directly specify the data type of a variable instead of letting the language guess it.

Example in TypeScript

let name: string = "Raj";
let age: number = 25;
let isActive: boolean = true;

Here:

  • string
  • number
  • boolean

are explicit types because we manually declared them.


Why called “Explicit”?

Because the type is written clearly by the developer.

let city: string = "Bangalore";

The type string is explicitly mentioned.


Opposite: Implicit Type

let city = "Bangalore";

Here TypeScript automatically understands it is a string.
This is called implicit type inference.