Open2023/03/12にコメント追加1TypeScriptで「すべてのプロパティがオプショナルかどうか」を判定する型パズルTypeScript型パズルきよしろー2023/03/12に更新type IsAllOptional<T> = { [K in keyof T]?: any } extends T ? true : false https://www.typescriptlang.org/play?exactOptionalPropertyTypes=false#code/C4TwDgpgBAkgzgQQDZIPJmASwPYDsCGSAPACoB8UAvFFAN5QDaA0lJrlANYQjYBmUJALoB+AFxR8uEFAC+UCAA9gEXABM4AqMKjAATgFdo43oTgQAUOdCQoyNBhwEkVOuZo0w+XfgC2cMXSYqqK4+j4ARhC6MgA0bu4Ajoa6IAEAShAAxti6qkRwemwA5jFQ+rgcuNgA7rhk5jKWSBDAUHAAFtj6SKokBhDi8HboWHiERMMOY0j1APSzNAB6wpZW4NAActjAk6NOLrTxHl6+cOK0QSFhkdFx7lBJUaniGdm5+YW4JWUVVbX1jWarQ6XR6ADFTANYIgUCNHOMtjtYVMnHMFlBluYgA
きよしろー2023/03/12に更新type IsAllOptional<T> = { [K in keyof T]?: any } extends T ? true : false https://www.typescriptlang.org/play?exactOptionalPropertyTypes=false#code/C4TwDgpgBAkgzgQQDZIPJmASwPYDsCGSAPACoB8UAvFFAN5QDaA0lJrlANYQjYBmUJALoB+AFxR8uEFAC+UCAA9gEXABM4AqMKjAATgFdo43oTgQAUOdCQoyNBhwEkVOuZo0w+XfgC2cMXSYqqK4+j4ARhC6MgA0bu4Ajoa6IAEAShAAxti6qkRwemwA5jFQ+rgcuNgA7rhk5jKWSBDAUHAAFtj6SKokBhDi8HboWHiERMMOY0j1APSzNAB6wpZW4NAActjAk6NOLrTxHl6+cOK0QSFhkdFx7lBJUaniGdm5+YW4JWUVVbX1jWarQ6XR6ADFTANYIgUCNHOMtjtYVMnHMFlBluYgA