microsoft / microsoft/TypeScript

Add types for `String.{matchAll,replaceAll}` with a well known symbol

Open
#61,448 3 comments 0 reactions 1 assignee Claimed by @rbuckton View on GitHub
Domain: lib.d.ts Help Wanted Possible Improvement
Dominant language
Go
Stars
111k
Forks
14.3k
PR merge metrics
PR metrics pending

Description

### ⚙ Compilation target

es2022

### ⚙ Library

ES2023

### Missing / Incorrect Definition

Definitions for `String.{matchAll,replaceAll}` with an object that implements `[Symbol.matchAll]`/`[Symbol.replace]`, rather than a pure RegExp.

### Sample Code

```TypeScript
const someObjectThatImplementsTheSymbols = ...; // e.g. https://github.com/segevfiner/node-pcre2
"foo".matchAll(someObjectThatImplementsTheSymbols);
"foo".replaceAll(someObjectThatImplementsTheSymbols, "bar");
```

### Documentation Link

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/matchAll
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replaceAll

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.