#Froncast😈 - Code Warnings

1 messages · Page 1 of 1 (latest)

midnight lichen
#

Hello! For the no-unsafe-argument warning is that TypeScript specific?

upper spade
midnight lichen
#

Which specific line(s) are throwing that warning?

upper spade
#

I hope that the screenshots are possible and it will be more convenient to look at them)

#

The code is working and in the current state, but I want to understand if it is possible to eliminate these warnings without ignoring them by disabling this rule

#

Original code was the following:

cardNumberElement = elements.create('cardNumber');
    cardExpiryElement = elements.create('cardExpiry');
    cardCvcElement = elements.create('cardCvc');

    cardNumberElement.mount('#card-number');
    cardExpiryElement.mount('#card-expiry');
    cardCvcElement.mount('#card-cvc');

    cardNumberElement.on('ready', (event) => {
      readyCardElements[event.elementType] = { ...event };
    });

    cardExpiryElement.on('ready', (event) => {
      readyCardElements[event.elementType] = { ...event };
    });

    cardCvcElement.on('ready', (event) => {
      readyCardElements[event.elementType] = { ...event };
    });

    cardNumberElement.on('change', (event) => {
      readyCardElements[event.elementType] = { ...event };
    });

    cardExpiryElement.on('change', (event) => {
      readyCardElements[event.elementType] = { ...event };
    });

    cardCvcElement.on('change', (event) => {
      readyCardElements[event.elementType] = { ...event };
    });```

and in my opinion this is bad, given that the same actions are performed, but with different elements.
empty cloak
#

Hi there, please allow me to jump in to help 🙂

upper spade
#

Of course, I'll be happy)

empty cloak
#

The /no-unsafe-argument is when the function called is defined with the type any, the mount function is designed this way as this function allows the input of multiple different types.
I'm afraid I don't have a better suggestion than to ignore this warning.

#

/no-unsafe-call is a warning for a similar reason.

upper spade
#

Okay!
Thanks for the answer🙂

empty cloak
#

🙇