3

I was reading this article on using observables and came across several instances where the writer wrote something like this:

map((value: IObj) => {
  return value.name!.value; // << What is this??
})

I've never seen this exclamation point and dot combo before. The writer does this a few times in the article for me to think that it's a typo. I know about ?. but I've never seen !. in JS, TypeScript, or Flow.

Can someone help me understand what that is? Specifically:

  • what is it called?
  • Is it JS or TS?
  • If JS, when was it introduced?
  • Most importantly, what does it do?
J.Ko
  • 964
  • 12
  • 26
  • 5
    Does this answer your question? [In Typescript, what is the ! (exclamation mark / bang) operator when dereferencing a member?](https://stackoverflow.com/questions/42273853/in-typescript-what-is-the-exclamation-mark-bang-operator-when-dereferenci) – VilleKoo Jan 18 '22 at 09:33
  • Postfix `!` is the TS non-null assertion operator. `.` is a plain JS property access. – FZs Jan 18 '22 at 09:33

0 Answers0