I've encountered a problem with a component in my app:
@Component({
selector: 'app-payment-intent',
templateUrl: './payment-intent.component.html',
styleUrls: ['./payment-intent.component.css']
})
export class PaymentIntentComponent implements OnInit {
static = false;
@ViewChild(StripeCardComponent, this.static) card: StripeCardComponent;
However, during app compilation, I receive the following error:
Object is possibly 'undefined'
The issue seems to stem from the static = false
variable, which causes
@ViewChild(StripeCardComponent, this.static) card
to potentially be interpreted as undefined
. Despite the variable being initialized as false
, this error persists.
Any advice on resolving this issue would be greatly appreciated!
Thank you!