basarat / basarat/typescript-book

Record Type

Open
#481 0 comments 2 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
21.6k
Forks
2.6k
PR merge metrics
No merged PRs in 30d

Description

# Record

Record allows you to create simple object bag definitions taking in two generic arguments (key and value).

As an example, at a simple level `Record` is same as `{[key:string]:string}`.

However because of the placement of the generic argument it can help with creating typesafe maps very conveniently e.g. `Record`. You can do the equivalent with mapped types i.e. `{ [P in Something]: string }` but the record version reads easier :rose:

Contributor guide

Open the contributing guide

Research direction

Start by locating the book section where TypeScript object, generic, or mapped types are documented; the issue provides the Record examples to use as context. Add a concise explanation of Record and its mapped-type equivalent, then verify that the new documentation fits the surrounding section and examples.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.