News Score: Score the News, Sort the News, Rewrite the Headlines

What the heck is a homomorphic mapped type?

Introduction Link to headingI remember back in the day when I stumbled upon the term homomorphic for the first time in the good ol' TypeScript handbook. Honestly, the handbook’s explanation was a bit fuzzy to me.After listing a couple of example mapped types:type Nullable<T> = { [P in keyof T]: T[P] | null }; type Partial<T> = { [P in keyof T]?: T[P] }; The handbook continued by saying:In these examples, the properties list is keyof T and the resulting type is some variant of T[P]. This is a goo...

Read more at andreasimonecosta.dev

© News Score  score the news, sort the news, rewrite the headlines