Describe the bug String.replaceAll is not recognized as valid command in TypeScript Editor but compiles and works correctly.
If you use it, replaceAll has a red line below it and the following error is shown:
Property 'replaceAll' does not exist on type 'string'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2021' or later.(2550)
But codes compiles and executes correctly, see below.
To Reproduce
Steps to reproduce the behavior:
Create a new type script file
Enter the code
let text:string = 'I think my dog is cuter than your dog';
log(text.replaceAll('dog', 'monkey'));
// Expected output: "I think my monkey is cuter than your monkey"
Start script
Find in log the line I think my monkey is cuter than your monkey
Expected behavior
Editor should accept replaceAll as correct code, see here
Describe the bug
String.replaceAll
is not recognized as valid command in TypeScript Editor but compiles and works correctly. If you use it,replaceAll
has a red line below it and the following error is shown:Property 'replaceAll' does not exist on type 'string'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2021' or later.(2550)
But codes compiles and executes correctly, see below.
To Reproduce
Steps to reproduce the behavior:
I think my monkey is cuter than your monkey
Expected behavior
Editor should accept replaceAll as correct code, see here
Versions: