const a: any = someValue !;

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



const a: any = someValue !;



I studied the source code of the mechanism changeDetaction in angular6 and came across an interesting design that neither I nor the guys from work know, The code here, does anyone know what it is or how it works? Specifically, line 60:


changeDetaction


let changes: SimpleChanges = undefined !;




1 Answer
1



If you take a look at the history of the file (e.g. blame view), you will find out how this line came into existence:



fix(core): Update types for TypeScript nullability support (#15472)



You will find the the non-null assertion operator in the TypeScript design notes which introduces



A new ! postfix expression-level operator.


!



It tells the compiler, that the value (and property) cannot be null. See also these related stackoverflow questions and answers:






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

Creating a leaderboard in HTML/JS