1

I've seen this a couple of times now, but my google-fu has failed me. In the course I'm taking, sometimes variable names will have an explanation point after them when they're declared, but not when used.

course!: any[];
@Input() set cName(name: string) {
    this.course = [];

It doesn't seem to be part of the variable name, so what does it indicate?

  • 1
    It's the [non-null assertion operator](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-0.html#non-null-assertion-operator). It tells typescript "i know it looks like this might be null/undefined, but trust me, it's not." – Nicholas Tower Aug 30 '22 at 20:45

0 Answers0