Ab initio calculations of the electronic structure and elastic properties of TiNi-based alloys were performed within density functional theory. The influence of impurities (transition, noble and simple metals) substituted both Ti or Ni atoms on the electronic structure of alloys near the Fermi level are analyzed. The formation energies of defects (antisites, vacancies, atomic swaps) are estimated. It is shown that Ni-antisites and swap defects have the lowest formation energies in TiNi-based alloys. The elastic constants of ternary TiNi-based alloys are calculated.