Angular | Typescript | ngxs state Observable: What does a variable ending with ! represent. @Select(someSelector) var $!: Observable<someType[]>> [duplicate]
In my TS file, i have a declaration like
import { Select } from '@ngxs/store';
@Injectable()
export class someService {
@Select(someSELECTOR) varName$!: Observable<someType[]>;
elements$ = this.varName$.pipe(
map(elements => elements.map(SOMElogic),
);
}
My question is in "varName$!", I know we use $ for representing observable, any idea what ! represents. Its not part of variable name, as when it is used below with pipe the ! is missing.
Does it represent anything in NGXS or Typscript or Angular.
Have a look at this post The "!" is the non-null-assertion operator of TypeScript. It doesn't represent anything NGRX or Angular specific.