Here we have this method:
export const showGiftedOrGiftingEmail = (
transaction: Transaction
): { [a: string]: string } | null => {
It clearly return an optional, either an object or null
. But here it accept the expression without ?
operator, why?
showGiftedOrGiftingEmail(props.transaction).email
or with ?
showGiftedOrGiftingEmail(props.transaction)?.email
What is the point of use Typescript if it does not force out this kind of type safety? Swift would never accept the first expression.