String.prototype.matchAll() is part of the ECMAScript 2020 specification (draft).
In TypeScript you can include these library features by adding es2020
or es2020.string
, in the compiler options:
"compilerOptions": {
"lib": ["es2020.string"]
}