In some old Angular apps, I made use of the isNumeric function in RXJS.

I could import it:

view plain print about
1import {isNumeric} from "rxjs/internal-compatibility";

And then use it:

view plain print about
1if (isNumeric(myStringValue)) {
2 // do stuff
3}

Unfortunately, isNumeric was hidden in RXJS. And seems completely gone in RXJS 7. I discovered this when updating an app for Angular 13.

In my use case I only cared about whether the input was an integer or not, so did not care about the other values. I was able to use native JavaScript to validate if my input string was an Integer or not::

view plain print about
1if (!Number.isInteger(parseInt(String(myStringValue), 10))) {
2 // do stuff
3}

There is a bunch going on here. First, I converted the myStringValue to a String. The TypeScript compiler wanted me to do this. Then I use parseInt() to turn the string into an integer. From there, I can use Number.isInteger().

This has been working surprisingly well for my use case even if it isn't a direct replacement for the isNumeric functionality.