Lesson 02 of 55
8 mins readPython Primitive Types: number, string, boolean & bigint
In Plain English
TypeScript mirrors JavaScript core primitives with static type annotations: `number`, `string`, `boolean`, `bigint`, `symbol`, `null`, and `undefined`.
Deep Dive: How It Works
number: Represents all numbers (integers, floats, NaN, Infinity).
string: UTF-16 string literals and template strings.
boolean: Values `true` and `false`.
bigint: Large arbitrary-precision integers (e.g. `100n`).
null & undefined: Handled strictly when `strictNullChecks` is enabled.
Core Rules to Remember

Lowercase Primitives: Always use lowercase `string`, `number`, `boolean` (never uppercase String or Number wrappers).

strictNullChecks: Prevents null or undefined from being assigned to non-nullable types.
Live Interactive Example
Hit Run Code to see it livePrimitive Type Annotations
Python 3.12
1
2
3
4
5
6
Output Console
Click "Run Code" to view the rendered output.
How it works: All primitive types were checked and formatted into the output string.
Your Turn: Micro Challenge
No pressure! Edit the starter code below and test your solution with instant feedback.
Micro Exercise
Annotate Server Config Primitives
Declare `const host: string = "zencompiler.com";` and `const port: number = 443;`.
Log `"Endpoint: " + host + ":" + port`.
1
2
Sandbox Output
Click "Run & Check" to test your solution.
Finished reading and practicing?
Mark this lesson as completed to update your course progress.