TypeScript
TypeScript Simple TypesTypeScript Simple Types
TypeScript locks variables into specific data types.
Read Time
5 min readDifficulty
BeginnerLast Updated
Jun 15, 2026Version
v1.0.0Introduction
In normal JavaScript, a variable can be a number on line one, and suddenly change to a text string on line two. TypeScript strictly forbids this. Developers use simple primitive types to lock down variables permanently.
Example
Example
Key Points
- Use `boolean` for true or false values.
- Use `number` for decimals or whole numbers.
- Use `string` for text characters.
- Add the colon `:` to specify the type.