1. TypeScript: Documentation - Narrowing

PHOTO EMBED

Mon May 31 2021 11:55:25 GMT+0000 (UTC)

Saved by @dimlaksana #typescript

typeof
type guards
As we’ve seen, JavaScript supports a typeof operator which can give very basic information about the type of values we have at runtime. TypeScript expects this to return a certain set of strings:

"string"
"number"
"bigint"
"boolean"
"symbol"
"undefined"
"object"
"function"
content_copyCOPY

https://www.typescriptlang.org/docs/handbook/2/narrowing.html