diff --git a/src/Fable.Transforms/Replacements.fs b/src/Fable.Transforms/Replacements.fs index 602d4d50ee..92c9fdd6f2 100644 --- a/src/Fable.Transforms/Replacements.fs +++ b/src/Fable.Transforms/Replacements.fs @@ -2550,6 +2550,7 @@ let strings | [ ExprType String ] | [ ExprType Char; ExprType(Number(Int32, NumberInfo.Empty)) ] | [ ExprType String; ExprType(Number(Int32, NumberInfo.Empty)) ] + | [ ExprType String; StringComparisonEnumValue ] | [ ExprType String ExprType(Number(Int32, NumberInfo.Empty)) StringComparisonEnumValue ] -> diff --git a/tests/Js/Main/StringTests.fs b/tests/Js/Main/StringTests.fs index 674077d266..a7c7eb271c 100644 --- a/tests/Js/Main/StringTests.fs +++ b/tests/Js/Main/StringTests.fs @@ -720,6 +720,10 @@ let tests = |> equal 4 testCase "String.IndexOf with StringComparison" <| fun () -> + "abcdbc".IndexOf("b", StringComparison.Ordinal) + |> equal 1 + + testCase "String.IndexOf with index and StringComparison" <| fun () -> "abcdbc".IndexOf("b", 3, StringComparison.Ordinal) |> equal 4 @@ -732,6 +736,10 @@ let tests = |> equal 1 testCase "String.LastIndexOf with StringComparison" <| fun () -> + "abcdbc".LastIndexOf("b", StringComparison.Ordinal) + |> equal 4 + + testCase "String.LastIndexOf with index and StringComparison" <| fun () -> "abcdbc".LastIndexOf("b", 3, StringComparison.Ordinal) |> equal 1