Skip to content

Definite assignment assertion on @Input properties #20

@fireflysemantics

Description

@fireflysemantics

Hi - Thanks for this awesome project! I've been reviewing the code base and just have a few suggestions that I think apply.

@input properties

They should not use a definite assignment assertion or !. New angular projects don't allow it. I double checked this with SO here:

https://stackoverflow.com/questions/59093938/angular-input-property-ending-with-exclamation-point''

Also I don't think this should be an @Input property:

@Input() token!:StripeToken

IIUC the component retrieves the Stripe Token via the Stripe API an then emits the value? Thus we never set it on the component ...

ng-container usage

We don't really need an ng-container in the stripe card:

<ng-container *ngIf="!StripeScriptTag.StripeInstance">
          <div style="color:red;">Stripe PublishableKey NOT SET. Use method StripeScriptTag.setPublishableKey()</div>
</ng-container>

IIUC - This will work just as well:

<div *ngIf="!StripeScriptTag.StripeInstance style="color:red;">Stripe PublishableKey NOT SET. Use method StripeScriptTag.setPublishableKey()</div>

ExportAs

Also don't think we need exportAs here:

exportAs:"StripeCard"

It should just export as StripeCard since that is what the component is named.

These things apply to both the stripe-card and the stripe-source.

Thanks again for this sweet project. I'm learning a lot by studying the code base.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions