mirror of
https://github.com/kamranahmedse/developer-roadmap.git
synced 2025-08-06 09:16:29 +02:00
Add content to TypeScript roadmap
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
|
||||
For example:
|
||||
|
||||
```
|
||||
```typescript
|
||||
const colors = ['red', 'green', 'blue'] as const;
|
||||
|
||||
// colors is now of type readonly ['red', 'green', 'blue']
|
||||
|
@@ -4,7 +4,7 @@ as is a type assertion in TypeScript that allows you to tell the compiler to tre
|
||||
|
||||
For example:
|
||||
|
||||
```
|
||||
```typescript
|
||||
let num = 42;
|
||||
let str = num as string;
|
||||
|
||||
|
@@ -4,7 +4,7 @@
|
||||
|
||||
For example:
|
||||
|
||||
```
|
||||
```typescript
|
||||
let anyValue: any = 42;
|
||||
|
||||
// we can assign any value to anyValue, regardless of its type
|
||||
|
@@ -2,9 +2,7 @@
|
||||
|
||||
The non-null assertion operator (!) is a type assertion in TypeScript that allows you to tell the compiler that a value will never be null or undefined.
|
||||
|
||||
For example:
|
||||
|
||||
```
|
||||
```typescript
|
||||
let name: string | null = null;
|
||||
|
||||
// we use the non-null assertion operator to tell the compiler that name will never be null
|
||||
|
Reference in New Issue
Block a user