Microsoft/TypeScript

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

Aberta

#61.448 aberto em 19 de mar. de 2025

 (3 comentários) (0 reação) (1 responsável)TypeScript (13.395 forks)batch import
Domain: lib.d.tsHelp WantedPossible Improvement

Métricas do repositório

Stars
 (108.860 estrelas)
Métricas de merge de PR
 (Métricas PR pendentes)

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

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

Guia do colaborador