in my case (angular 16), angular didn't recognize the xml2js library and this worked:
npm i --save-dev @types/xml2js