paint-brush
Using the typeof Operator in TypeScriptby@smpnjn
14,202 reads
14,202 reads

Using the typeof Operator in TypeScript

by Johnny Simpson2mJuly 4th, 2022
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

In TypeScript, we already have a vanilla `typeof` operator which can be used to find the type of anything. Typeof` can also be combined with `ReturnType` to get the returned value of a function. The most basic application of typeof` in TypeScript is the creation of new basic types. It can be useful when creating custom types that have many properties where the properties should match existing variable types. The typeof operator is used to differentiate between the **value** and **type** of an object.

Company Mentioned

Mention Thumbnail
featured image - Using the typeof Operator in TypeScript
Johnny Simpson HackerNoon profile picture
Johnny Simpson

Johnny Simpson

@smpnjn

Product, Engineering, Web

About @smpnjn
LEARN MORE ABOUT @SMPNJN'S
EXPERTISE AND PLACE ON THE INTERNET.
L O A D I N G
. . . comments & more!

About Author

Johnny Simpson HackerNoon profile picture
Johnny Simpson@smpnjn
Product, Engineering, Web

TOPICS

THIS ARTICLE WAS FEATURED IN...

Permanent on Arweave
Read on Terminal Reader
Read this story in a terminal
 Terminal
Read this story w/o Javascript
Read this story w/o Javascript
 Lite