Skip to content

Commit d39996e

Browse files
committed
Fix type of RegExp.Result.matches
1 parent e950b11 commit d39996e

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

runtime/Stdlib_RegExp.res

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ type t
33
module Result = {
44
type t = array<option<string>>
55
@get_index external fullMatch: (t, @as(0) _) => string = ""
6-
@send external matches: (t, @as(1) _) => array<string> = "slice"
6+
@send external matches: (t, @as(1) _) => array<option<string>> = "slice"
77
@get external index: t => int = "index"
88
@get external input: t => string = "input"
99
}

runtime/Stdlib_RegExp.resi

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,15 @@ module Result: {
4343
// This below will log "ReScript" and "is" to the console.
4444
switch regexp->RegExp.exec("ReScript is pretty cool, right?") {
4545
| None => Console.log("Nope, no match...")
46-
| Some(result) => switch result->RegExp.Result.matches {
46+
| Some(result) => switch result->RegExp.Result.matches->Array.keepSome {
4747
| [firstWord, secondWord] => Console.log2(firstWord, secondWord)
4848
| _ => Console.log("Didn't find exactly two words...")
4949
}
5050
}
5151
```
5252
*/
5353
@send
54-
external matches: (t, @as(1) _) => array<string> = "slice"
54+
external matches: (t, @as(1) _) => array<option<string>> = "slice"
5555
@get external index: t => int = "index"
5656

5757
/**

0 commit comments

Comments
 (0)