News for hackers. Stuff that matters.
Re:Tricks I wish I knew when I learned TypeScript by goto11 on Tuesday October 12, 2021 @09:29AM (#28839409)
Utility types are useful for example in the React API. You have a "state" defined as a set of properties. Then you have a setState() method where you return the set of properties you want to update, which may be a subset of the full state. So if the type of the component state is TState, then the return type of setState() can be defined as Partial<TState>.

There are no comments on this comment yet.