
While exploring the source code of a TSLint rule, I encountered an interesting syntax: if (node.parent!.kind === ts.SyntaxKind.ObjectLiteralExpression) { return; } The ! operator after node.parent caught my attention. What does it do? Investigating the ! Operator At first, I attempted to compile the file using my existing TypeScript version (1.5.3). This resulted in an error pointing directly to the exclamation mark: $ tsc --noImplicitAny memberAccessRule.ts noPublicModifierRule.ts(57,24): error TS1005: ')' expected. Realizing…