Here is the Angular 5 code snippet I have written:
gotToWallet(wallet) {
const { countryId = '', currencyType = '' } = wallet || {};
let walletIdentity;
switch (currencyType) {
case 'CRYPTO':
walletIdentity = 'userWalletIdentity';
break;
case 'FIAT':
walletIdentity = 'fiatWalletIdentity';
break;
case 'ERC20TOKEN':
walletIdentity = 'xbxUserWalletIdentity';
break;
}
const { currencyId = '' } = (wallet || {})[walletIdentity] || {};
this.router.navigate([`walletMgmt/wallet-details/${currencyId}/${countryId}`]);
}
Upon running the ng build
command, the following error occurs:
ERROR in src/app/wallet-management/wallets/wallets.component.ts(202,12): error TS2678: Type '"CRYPTO"' is not comparable to type '""'.
src/app/wallet-management/wallets/wallets.component.ts(205,12): error TS2678: Type '"FIAT"' is not comparable to type '""'.
src/app/wallet-management/wallets/wallets.component.ts(208,12): error TS2678: Type '"ERC20TOKEN"' is not comparable to type '""'.
I am puzzled by why this error is only appearing during the build process and not when using ng serve
.
Any guidance on resolving this issue would be greatly appreciated.
Thank you for your assistance.