Re:Value Objects – DDD with TypeScript
by SmooL on Sunday April 07, 2019 @11:01PM
(#19601596)
As an aside, is no one else bothered by the ubiquitous null/undefined checks? Almost every function implementation here is started with checking that the args are actually what is expected.
I get that typescript is only a compile time check and doesn't guarantee type correctness at runtime, but if I feel like there might be larger problems here to solve first if my function takes in type string and the first thing I have to do is make sure it's not null or undefined. If you legitimately expect either a string or null, there are proven ways to deal with this (Maybe/Optional).
I get that typescript is only a compile time check and doesn't guarantee type correctness at runtime, but if I feel like there might be larger problems here to solve first if my function takes in type string and the first thing I have to do is make sure it's not null or undefined. If you legitimately expect either a string or null, there are proven ways to deal with this (Maybe/Optional).