Why does genType introduce "after" field?

I have some bindings that use genType:

type t = {
  discover: SearchDuck.t,
  features: FeaturesDuck.t,
  gameDetails: GameDetailsDuck.t,
  modals: ModalsDuck.t,
  search: SearchDuck.t,
  session: SessionDuck.t,
  validations: ValidationsDuck.t,

external useSelector: (t => 'slice) => 'slice = "useSelector"

The code above generates the following in TS:

export const useSelector: unknown = function <slice>(Arg1: any) {
  const result = useSelectorTypeChecked(function (Arg11: any) {
      const result1 = Arg1({discover:{after:Arg11.discover.after, facets:Arg11.discover.facets, modtoolsReleaseId:Arg11.discover.modtoolsReleaseId, modtoolsVisible:Arg11.discover.modtoolsVisible, query:Arg11.discover.query, resultsFormat:$$toRE155959308[Arg11.discover.resultsFormat], selectedFacets:Arg11.discover.selectedFacets, sortOrder:0, sortOrders:Arg11.discover.sortOrders.map(function _element(ArrayItem: any) { return 0})}, features:Arg11.features, gameDetails:Arg11.gameDetails, modals:Arg11.modals, search:{after:Arg11.search.after, facets:Arg11.search.facets, modtoolsReleaseId:Arg11.search.modtoolsReleaseId, modtoolsVisible:Arg11.search.modtoolsVisible, query:Arg11.search.query, resultsFormat:$$toRE155959308[Arg11.search.resultsFormat], selectedFacets:Arg11.search.selectedFacets, sortOrder:0, sortOrders:Arg11.search.sortOrders.map(function _element(ArrayItem1: any) { return 0})}, session:Arg11.session, validations:Arg11.validations});
      return result1
  return result
} as <slice>(_1:((_1:t) => slice)) => slice;

Notice the inclusion of fields named after, e.g., {after:Arg11.discover.after ...}. These fields aren’t present in any of my types and don’t correspond to any fields in my data on the JS side.

Why does genType insert after fields and how can I get rid of them? I end up getting errors like Cannot read property 'after' of undefined on the JS side.

It would seem that after is one of the fields of SearchDuck.t. Also, that SearchDuck.t contains some types requiring conversions (such as ordinary variants). It’s always better to try to use types that require no conversion.

You’re right, this was my fault. For some reason, I had overlooked the inclusion of the after field in SearchDuck.t. My bad!