5 ms·
Yes, I disagree on #10 as well. Because: createNewMessagesResponse(null) 'You have null new messages' Of course, TypeScript will say that 'null' can't
by WA 6y ago
Yes, I disagree on #10 as well. Because:
createNewMessagesResponse(null)
'You have null new messages'
Of course, TypeScript will say that 'null' can't be passed to createNewMessagesResponse directly. However, data gets pushed around a code base a lot and might go through third party packages or come in from an API response and could very well be 'null'. I proactively don't check for 'undefined', because I can't really trust this to be 'undefined'. Furthermore, in the example OP provided, 'null' and 'undefined' should have the same result (no message is shown, because no number was passed to the function).