1

I'm watching an Angular issue on Github and I've ran into interesting .ts syntax, I've never seen before. I've tried to understand it and check how it works in practice, but... I don't understand.

Link to script on Github

This script was reviewed by someone from Angular team and generally accepted.

Syntax looks simple and wierd and it appears a few times in code:

const outlet = context !.outlet !;

this.deactivateRouteAndItsChildren(v, contexts !.getContext(k))

this.shouldRunGuardsAndResolvers(
      curr, future, future.routeConfig !.runGuardsAndResolvers)

It looks like someone is checking if someObj !.someProp exists, but if it doesn't, it returns undefined. Hmm for me it looks like it's the same as writing just someObj.someProp isn't it?

Could someone explain me whats the usage?

Salarenko
  • 105
  • 5
  • 4
    Check [this](https://stackoverflow.com/questions/42273853/in-typescript-what-is-the-exclamation-mark-bang-operator-when-dereferenci). – Lysandros Nikolaou Mar 22 '18 at 12:02
  • Oh thanks! I've searched stack before, but didn't find the answer. Looks like my question is a duplicate :/ What's still interesting for me is the space between object and property. – Salarenko Mar 22 '18 at 12:06

0 Answers0