|
|
|
|
|
by _fat_santa
1710 days ago
|
|
I found that pattern useful when you don't know what the key will be. I have an iOS app that tracks tips, when you add a tip, it's stored in an object like this: type Tips = {
[tipGuid: string]: TipObject
} which can be rewritten using Record as type Tips = Record<string, TipObject> That pattern ins't very useful when creating object with known keys but for data structures where the key is either not known or generated it a godsend. |
|