Open JoviDeCroock opened 11 months ago
We'll probably be able to support this similar to https://github.com/StellateHQ/fuse.js/pull/107 with overriding the global-type so something along the lines of BaseScalars & UserScalars
.
On top of that we export some scalarType
helper for folks to add their own scalars, in the docs we should document that we added JSON
and DateTime
for our consumers and link to common scalars like GraphQL-Scalars.
One thing that we still need to think about is how we'll integrate this with codegen, this could be a follow-up issue though, i.e. it could be part of a configuration file like the graphql-config file.
EDIT: the above becomes less of an issue with gql.tada
as folks can add the types for the scalars themselves in the fuse/tada.ts
file, we should ensure that we don't override this file.
Summary
We need to support custom-scalars, this currently has a bit of a roadblock with regards to the
schema-builder
where it will expect the custom scalars to be present on thegeneric
or it won't know how to type them. Maybe we can be clever and tell TypeScript that anything we don't know how to type should beunknown
orany
but that does loosen our strict-typings.We would then need to extend the custom scalars to the configuration in our codegen, it's possible that they are automatically picked up and case to
unknown
but ideally the user is enabled to type these themselves.