#Froncast😈 - Code Warnings
1 messages · Page 1 of 1 (latest)
Hello!
Difficult to answer
As far as I understand, this is limited only by the rules eslint and it is recommended to fix it
Link to official documentation https://typescript-eslint.io/rules/no-unsafe-argument/
Despite your best intentions, the any type can sometimes leak into your codebase.
Which specific line(s) are throwing that warning?
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.
Hi there, please allow me to jump in to help 🙂
Of course, I'll be happy)
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.
Okay!
Thanks for the answer🙂
🙇