Types and inference
Use the primitive types
Describe string, number, boolean, bigint, symbol, null, and undefined values with lowercase TypeScript type names.
TypeScript uses lowercase names for JavaScript primitive values:
const title: string = 'TypeScript Course'
const lessons: number = 42
const published: boolean = true
Use string, number, and boolean, not String, Number, and Boolean. The capitalized names describe boxed wrapper objects that rarely belong in application types.
JavaScript uses one number type for ordinary integers and floating-point values. TypeScript does not add runtime int or float values.
Other primitives include bigint, symbol, null, and undefined. A type describes which values are allowed; it does not change their JavaScript behavior.
With strict null checking, null and undefined are not automatically accepted as strings or objects. Include them only when absence is part of the contract.
Exercise: declare one value with each lowercase primitive type. Then try replacing string with String and inspect the editor type before deciding why the lowercase form is clearer.
Lesson completed