TypeScript conditional types – filter out readonly properties / pick only required properties
Update 2018-10: @MattMcCutchen has figured out that it is possible to detect readonly fields (invalidating the struck-out passage below), as shown in this answer. Here is a way to build it: type IfEquals<X, Y, A=X, B=never> = (<T>() => T extends X ? 1 : 2) extends (<T>() => T extends Y ? 1 : … Read more