Port XRegExp to TS so it plays nicely with the new build system.