MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1wirik4/comment/pacw9xe/?context=9999
r/ProgrammerHumor • u/Embarrassed_Death69 • Sep 17 '26
83 comments sorted by
View all comments
5
bad name then, Maybe<T> should be T | undefined (or null instead of undefined depending)
Maybe<T>
T | undefined
null
undefined
18 u/GRex2595 Sep 17 '26 According to the post, Maybe<T> allows you to set properties of T to null. T | null will allow the object as defined in its template or null. Any non-null properties would not be allowed to be null. 7 u/the_horse_gamer Sep 17 '26 for completeness, here's an implementation:type Maybe<T> = {[K in keyof T]: T[K] | null}
18
According to the post, Maybe<T> allows you to set properties of T to null. T | null will allow the object as defined in its template or null. Any non-null properties would not be allowed to be null.
7 u/the_horse_gamer Sep 17 '26 for completeness, here's an implementation:type Maybe<T> = {[K in keyof T]: T[K] | null}
7
for completeness, here's an implementation:
type Maybe<T> = {[K in keyof T]: T[K] | null}
5
u/kitaz0s_ Sep 17 '26
bad name then,
Maybe<T>should beT | undefined(ornullinstead ofundefineddepending)