3π
β
.toUpperCase()
is a method provided by the String-class. It seems your variable this.checkDeliveryType
isnβt a string, hence you can not call this method (as it does not exist on whatever type your variable is at that point in time).
Either fix the type or cast the value manually to a string before and call .toUpperCase()
on it afterwards. One way would be:
const checkDeliveryTypeStr = `${this.checkDeliveryType}`;
const keyToDisplayMessage = `${checkDeliveryTypeStr.toUpperCase()}_${this.selectedAddressType.toUpperCase()}`;
But in general it would be a better idea to fix the type correctly in your entire flow.
π€Philipp Meissner
Source:stackexchange.com