Closed liontariai closed 4 months ago
This feature is similar to what is being discussed at Apollo Client here: https://github.com/apollographql/apollo-feature-requests/issues/368
Right now only the canonical examples Date and JSON are supported, because not only the custom parse function is needed, but also a type mapping.
For this, the question is if it has to be either provided on codegen-time or it can be configured in runtime with a config-factory approach, where a type generic is passed and thus assigns the right type to the fields in Typescript.
This PR enables custom scalar parsing on the client side. Values are parsed lazily, only when accessed.
As default, the following scalars are implement as follows:
Arrays and nested arrays of custom scalars are supported.
Custom parsing implementations can be configured with the
.init
function: