[Rescript] initAvo
complete
n
nick.tytarenko@sothebys.com
hey. we created a source for Rescript web application and it sends the data to segment destination.
I am doing this:
Avo.initAvo(~env=#dev, ~segmentSothebysWebDestination=inspectorCustomDestination, ())
and you could see that there is a required property called
segmentSothebysWebDestination
and according to the Rescript code the type of this is the following:
type avoCustomDestination = {
make: (avoEnvType, option(string)) => unit,
logEvent: (string, Js.Json.t) => unit,
logPage: (string, Js.Json.t) => unit,
revenue: (float, Js.Json.t) => unit,
setUserProperties: (string, Js.Json.t) => unit,
identify: (string) => unit,
unidentify: unit => unit,
setGroupProperties: (string, string, Js.Json.t) => unit,
addCurrentUserToGroup: (string, string, Js.Json.t) => unit,
logEventWithGroups: (string, Js.Json.t, Js.Json.t) => unit
};
it means that all properties are required
but in your doc here:
you could see that some methods are optional like (make, revenue, setGroupProperties etc)
is it a bug in your code for rescript?
because for exmaple in Typescript code all properties are optional
Solvi Logason
complete
Solvi Logason
Hey nick.tytarenko@sothebys.com, I've confirmed that all methods in the Rescript destination interface are required (we didn't find a nice way to make them optional within Rescript's strict type system). For those you don't want to implement, you can leave as no-ops.
Here's an example of a destination interface in Rescript: https://www.avo.app/docs/implementation/reference/rescript#destination-interface-example
Solvi Logason
Hey nick.tytarenko@sothebys.com, afaik they should be optional, but let me double check. In any case, you can leave the implementation of them empty, or make them log out something indicating they are a no-op in the destination interface implementation.