Suggest an editImprove this articleRefine the answer for “Primitive types”. Your changes go to moderation before they’re published.Approval requiredContentWhat you’re changing🇺🇸EN🇺🇦UAPreviewTitle (EN)Short answer (EN)TypeScript has several **primitive types** - the basic building blocks of the language (that is, not objects and with no methods except the built-in ones via the prototype). **Key point:** the primitive types are `string`, `number`, `boolean`, `bigint`, `symbol`, `null`, `undefined`, alongside the special utility types `void`, `never`, `unknown`, `any`.Shown above the full answer for quick recall.Answer (EN)ImageTypeScript has several **primitive types**, which are the basic building blocks of the language (that is, not objects and with no methods except the built-in ones via the prototype). Here is the full list: --- ### Main primitive types 1. `string` - a string Used for text data. ```javascript let name: string = "Tim"; ``` 2. `number` - a number Covers both integer and fractional values (all numbers are floating-point). ```javascript let age: number = 25; let price: number = 19.99; ``` 3. `boolean` - a boolean value (true/false) ```javascript let isOnline: boolean = true; ``` 4. `bigint` - an integer of arbitrary length (ES2020+) Used when you need to work with very large numbers. ```javascript let big: bigint = 123456789012345678901234567890n; ``` 5. `symbol` - a unique identifier (ES2015+) Guarantees the uniqueness of a value, often used as an object key. ```javascript const id: symbol = Symbol("id"); ``` 6. `undefined` - the "not defined" value Usually means that a variable is declared but has no value. ```javascript let value: undefined = undefined; ``` 7. `null` - the intentional absence of a value ```javascript let empty: null = null; ``` --- ### Special (not quite primitive, but closely related) 8. `void` - "returns nothing" Used as the type of a function that returns no value. ```javascript function logMessage(): void { console.log("Hello"); } ``` 9. `never` - "never happens" Used for functions that **never complete successfully** (for example, they throw an error or loop forever). ```javascript function fail(): never { throw new Error("Error!"); } ``` 10. `unknown` - an "unknown type" A safe alternative to `any`. Requires a check before use. ```javascript let data: unknown = "Hello"; if (typeof data === "string") { console.log(data.toUpperCase()); } ``` 11. `any` - "any type" Turns off type checking (used rarely and carefully). ```javascript let something: any = 123; something = "text"; // allowed ``` --- ### Summary: | Category | Types | |---|---| | Primitive | `string`, `number`, `boolean`, `bigint`, `symbol`, `null`, `undefined` | | Special utility | `void`, `never`, `unknown`, `any` |For the reviewerNote to the moderator (optional)Visible only to the moderator. Helps review go faster.