Property 'matchAll' does not exist on type 'string' : <p>I want to apply Reg Expression on string. In order to get all groups result i am using matchAll method. Here is my code</p>

<pre><code>const regexp = RegExp('foo*','g'); 
const str = "table football, foosball";
let matches = str.matchAll(regexp);

for (const match of matches) {
   console.log(match);
}
</code></pre>

<p>during compiling on above code i got error</p>

<blockquote>
  <p>Property 'matchAll' does not exist on type '"table football, foosball"'</p>
</blockquote>

<p>during searching about this error i found similar issue on stackoverflow </p>

<p><a href="https://stackoverflow.com/questions/51811239/ts2339-property-includes-does-not-exist-on-type-string">TS2339: Property &#39;includes&#39; does not exist on type &#39;string&#39;</a></p>

<p>I changed tsconfig configuration as mention in above link but my issue did not solved</p>

<p>Here is my tsconfig code;</p>

<pre><code>{
 "compileOnSave": false,
 "compilerOptions": {
 "baseUrl": "./",
 "importHelpers": true,
 "outDir": "./dist/out-tsc",
 "sourceMap": true,
 "declaration": false,
 "module": "es2015",
 "moduleResolution": "node",
 "emitDecoratorMetadata": true,
 "experimentalDecorators": true,
 "target": "es2016",
 "typeRoots": [
  "node_modules/@types"
 ],
"lib": [
  "es2018",
  "dom"
]
}
}
</code></pre>
