import replaceString = require ( 'replace-string' ) ; declare global { interface String { replaceAll ( search , replacement ) : string ; } } if ( ! String . prototype . replaceAll ) { String . prototype . replaceAll = function ( this , search , replacement ) { return replaceString ( this , search , replacement ) ; } ; }