const versions = ['0.2.3', '0.23.3@test', '1.1.0', '2.3', '2.0.4.5','2.12'];
let maxVersion:string[] = []
versions.forEach(version => {
const arr = version.split(/[^d]+/)
for (const i in arr) {
if(!maxVersion[i] || +arr[i] > +maxVersion[i]) return maxVersion = arr
if (+arr[i] === +maxVersion[i]) continue;
break;
}
return
})
console.log(maxVersion.join('.'))