Most of the migration has gone smoothly, but I find myself stuck with this error:
69 │ make(
70 │ config(~schema=augmentedSchema, ~playground=true, ~context=makeCont
│ extHandler(driver)),
71 │ )["applyMiddleware"](middleware(~app))
72 │ }
73 │
This expression has type
Js_OO.Meth.arity1<Nomos.ApolloServer.middleware => Express.Middleware.t>
It is not a function.
The relevant Reason code:
ApolloServer.(
make(
config(
~schema=augmentedSchema,
~playground=true,
~context=makeContextHandler(driver),
),
)##applyMiddleware(
middleware(~app),
)
);
And the relevant bits of ApolloServer.re
:
type apolloServerInstance = {
.
[@bs.meth] "applyMiddleware": middleware => Express.Middleware.t,
};
[@bs.module "apollo-server-express"] [@bs.new]
external make: config => apolloServerInstance = "ApolloServer";
These were auto-converted to the following Rescript:
{
open ApolloServer
make(
config(~schema=augmentedSchema, ~playground=true, ~context=makeContextHandler(driver)),
)["applyMiddleware"](middleware(~app))
}
and ApolloServer.res
:
type apolloServerInstance = {@meth "applyMiddleware": middleware => Express.Middleware.t}
@module("apollo-server-express") @new
external make: config => apolloServerInstance = "ApolloServer"
I’m somewhat confused by the error, as I believe the auto-translated Rescript code appears correct when it comes to calling a method as defined via @meth
, according to the spiffy new decorator docs.
Additionally, the error itself lists the type as Js_OO.Meth.arity1<Nomos.ApolloServer.middleware => Express.Middleware.t>
, which would seem to imply the capacity to call the method in the above manner.
What am I missing here?