This source code has @Input
properties that end with a !
. Here's an example:
@Input() token!:StripeToken
Why is it useful to have the !
in this case? Some of the comments have noted that it is a non null assertion operator, but why is it useful (Or perhaps not useful) to have that in this particular scenario?
I think the answer to this is that for Angular @Input
properties having the non null assertion at the end of the property never makes sense but I wanted to see what the rest of you thought?
Update
I tried it on a new Angular project and I get this error:
A definite assignment assertion '!' is not permitted in this context.ts(1255)
So I don't think that it ever makes sense to inlude the !
operator on an @Input
property. Here's a screenshot: