paint-brush
How Records Can Help You Implement Complex Data in Typescript by@smpnjn
387 reads
387 reads

How Records Can Help You Implement Complex Data in Typescript

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

Too Long; Didn't Read

A Record is a utility type especially defined by TypeScript to help with a certain problem. Record types enforce key values, and allow you to create custom interfaces for the values. They are a great way to ensure consistency when trying to implement more complex types of data. A Record takes the form `Record<K, T` where`K` is the type of the key, and `T` is the type the values the key is allowed to be. In this case, we can define a type for User and a union type for our key.
featured image - How Records Can Help You Implement Complex Data 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
Codytechs