TypeScript !. & ?. All In One
TypeScript Bang! (non-null assertion operator)
?.
const columns = [{ 100}];
const widthColumnCount = columns?.filter(({ width }) => !width).length;
/*
"use strict";
const columns = [{ 100 }];
const widthColumnCount = columns === null || columns === void 0 ? void 0 : columns.filter(({ width }) => !width).length;
*/
!.
const columns = [{ 100}];
const widthColumnCount = columns!.filter(({ width }) => !width).length;
/*
"use strict";
const columns = [{ 100 }];
const widthColumnCount = columns.filter(({ width }) => !width).length;
*/
https://www.typescriptlang.org/play?
refs
https://dev.to/pssingh21/safe-navigation-operator-bang-bang-bang-192j
©xgqfrms 2012-2020
www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!
原创文章,版权所有©️xgqfrms, 禁止转载 ️,侵权必究⚠️!