rescript-lang / rescript-core

A drop-in standard library for ReScript. Intended to be familiar for JavaScript developers, easy to use, and be rich enough (without being bloated) so that you don't need to reach for anything else for typical ReScript development.
MIT License
162 stars 28 forks source link

RegExp.Result.t is unsafely typed for optional capture groups #232

Closed illusionalsagacity closed 4 months ago

illusionalsagacity commented 4 months ago

see https://forum.rescript-lang.org/t/regexp-result-t-inconsistency/5326

https://github.com/rescript-association/rescript-core/blob/0b4bd00f518430f41bdfc8703b48191b458b4ded/src/Core__RegExp.res#L4

Js.String2.match_ here is typed as returning option<array<option<t>>>