This package includes the core-js polyfill for String#replaceAll, along with TypeScript typings.
The replaceAll function is defined in this TC39 proposal.
npm install --save ts-replace-allimport 'ts-replace-all'
'test'.replaceAll('t', '1')
'test'.replaceAll('t', () => '2')
'test'.replaceAll(/t/g, '3')
'test'.replaceAll(/t/g, () => '4')The API specification is available in the TC39 proposal.