graphql-typed-client
graphql-typed-client copied to clipboard
Serialization of array of custom scalars fails
I created custom Time type map like this:
Time: {
serialize: (time: moment.Moment) => time.format("HH:mm:ss"),
deserialize: (time: string) => moment(time, "HH:mm:ss"),
}
When mutation accepts single Time value, it works ok. But when it accepts array ([Time!]), serialize function receives array of moment objects instead of getting them one by one.
On the screenshot below, time does not have format because time is array of moments, not moment object.

Mutation is called like this:
graphqlClient.chain.mutation
.userProfileUpdate({input: {times: [
moment("08:00", "HH:mm"),
moment("14:00", "HH:mm"),
moment("20:00", "HH:mm"),
]}})