A better alternative to TypeScript’s non-null assertive operator

1 · Patrick Smith · May 14, 2020, 6:33 a.m.
TypeScript supports using ! for telling the compiler that the value is not null or undefined. This is known as the non-null assertive operator. However, it is simply stripped out when transpiling to JavaScript. No check is done at runtime. So, unlike the name suggests, we are not actually asserting anything. It would be better, […]...