Ran into something peculiar here.
This is the gist of the code, which compiles fine in rescript playground ReScript Playground (rescript-lang.org)
My project won’t compile while the .resi file is present or the specification for remove_value_from_el_at_idx_and_update/2 is present in the .resi file.
There I tried messing around with just returning None from remove_value_from_el_at_idx_and_update/2 with the specification still present in the .resi file, and that works, but whenever I try returning a Some the compilation error pops up.
Compiles with no issues
let remove_value_from_el_at_idx_and_update: (array<remove_and_update_list_interface<'collection, 'a>>, int) => option<('a, array<'collection>)>
= (xs, idx) => {
let ys: array<'collection> = xs->Js.Array2.map(x => x.collection)
None
}
while this will cause a compilation error
let remove_value_from_el_at_idx_and_update: (array<remove_and_update_list_interface<'collection, 'a>>, int) => option<('a, array<'collection>)>
= (xs, idx) => {
let ys: array<'collection> = xs->Js.Array2.map(x => x.collection)
Some((1, ys))
}
yields the compilation error:
The implementation C:\Users\jgood\Desktop\dev\candle-aggregation-res-v2\src\utils\CandleAggregationUtils.res
does not match the interface src\utils\candleAggregationUtils-CandleAggregation.cmi:
Values do not match:
let remove_value_from_el_at_idx_and_update: (
array<remove_and_update_list_interface<'collection, int>>,
int,
) => option<(int, array<'collection>)>
is not included in
let remove_value_from_el_at_idx_and_update: (
array<remove_and_update_list_interface<'collection, 'a>>,
int,
) => option<('a, array<'collection>)>
File "C:\Users\jgood\Desktop\dev\candle-aggregation-res-v2\src\utils\CandleAggregationUtils.resi", line 19, characters 1-144:
Expected declaration
File "C:\Users\jgood\Desktop\dev\candle-aggregation-res-v2\src\utils\CandleAggregationUtils.res", line 157, characters 5-43:
Actual declaration
I hope I’m not missing something glaringly obvious.