Skip to content

Commit 63a017b

Browse files
committed
book(изменение): change NonNullable
change NonNullable
1 parent 99e93c1 commit 63a017b

File tree

1 file changed

+2
-2
lines changed
  • book/ru/chapters/047.(Расширенные типы) Exclude, Extract, NonNullable, ReturnType, InstanceType, Omit, Awaited

1 file changed

+2
-2
lines changed

book/ru/chapters/047.(Расширенные типы) Exclude, Extract, NonNullable, ReturnType, InstanceType, Omit, Awaited/content.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ let v2: IB = intersection(a, b); // Error -> Property 'c' is missing in type 'Pi
104104
`````ts
105105
// @filename: lib.d.ts
106106

107-
type NonNullable<T> = T extends null | undefined ? never : T;
107+
type NonNullable<T> = T & {};
108108
`````
109109

110110
Простыми словами, данный тип удаляет из аннотации типа такие типы, как `null` и `undefined`.
@@ -318,4 +318,4 @@ type B = Awaited<Promise<Promise<string>>>;
318318

319319
// C = string | number
320320
type C = Awaited<string | Promise<number>>;
321-
`````
321+
`````

0 commit comments

Comments
 (0)