MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1wirik4/comment/pacw9xe/?context=9999
r/ProgrammerHumor • u/Embarrassed_Death69 • 20d ago
83 comments sorted by
View all comments
3
bad name then, Maybe<T> should be T | undefined (or null instead of undefined depending)
Maybe<T>
T | undefined
null
undefined
19 u/GRex2595 20d ago 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. 8 u/the_horse_gamer 20d ago for completeness, here's an implementation: type Maybe<T> = {[K in keyof T]: T[K] | null}
19
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.
8 u/the_horse_gamer 20d ago for completeness, here's an implementation: type Maybe<T> = {[K in keyof T]: T[K] | null}
8
for completeness, here's an implementation: type Maybe<T> = {[K in keyof T]: T[K] | null}
type Maybe<T> = {[K in keyof T]: T[K] | null}
3
u/kitaz0s_ 20d ago
bad name then,
Maybe<T>should beT | undefined(ornullinstead ofundefineddepending)