Double double questionmarks in TypeScript

It’s the nullish coalescing operator that has been proposed for ecmascript and has been implemented in Typescript. You can read more here or here

The gist of it is that

const dealType = currentDealType ?? originalDealType;

is equivalent to:

const dealType = currentDealType !== null && currentDealType !== void 0 ? currentDealType : originalDealType;

Or in words: if currentDealType is null or undefined use originalDealType otherwise use currentDealType

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)