I have created this helper to return VAT.
export const hasVAT = (country: string) => {
const VATRates = {
AT: 20, // Austria,AT
BE: 21, // Belgium,BE
BG: 19, // Bulgaria,BG
CZ: 21, // Czech Republic,CZ
CY: 19, // Cyprus,CY
DK: 25, // Denmark,DK
...
};
return country in VATRates ? VATRates[country] : false;
};
But receiving this Type error Element implicitly has an 'any' type because expression of type 'string' can't be used to index type ...'
any ideas?
VATRates
? If you doconst VATRates: {[keys: string]: number} = ...
you should not get any error. – acbay