Closed mr-zwets closed 2 months ago
Custom scalars are expected to be unknown. You have to tell us how they are typed check the init function here https://gql-tada.0no.co/reference/gql-tada-api
Ah thanks, that helps!
so I need to use initGraphQLTada()
with an AbstractSetupSchema
?
It seems setupSchema
also accepts a scalars
config object.
I have no experience using scalars, so I'm not exactly sure what the keys would be...
I assume need to define the 8 unknown types and that I can just put string
as type (and adjust later if needed)?
Excuse me for wrongly filing a bug report and thank you for your time
Okay I think I got it! 😃 The types for the 'customs scalars' are now those provided by myself!
for reference, I created a schema.ts
file
import type { introspection } from './generated/graphql-env.d.ts';
declare module 'gql.tada' {
interface setupSchema {
introspection: introspection;
scalars: {
Boolean: string
String: string
_text: string
bigint: string
bytea: string
};
}
}
Thanks again for pointing me in the right direction! Will close the issue 👍
You don't need to polyfill String/Boolean as those are defaults
Describe the bug
Hello, I hope I am correct i am correct in filing this as a bug report.
First, the setup experience with gql-tada has been really smooth and I really like what I already got working 💯
Problem
The problem (bug) I'm running into is that all return elements from a query are being typed as
unknown
Because they return as type
unknown
I would have to typecast all the object elements when accessing the properties.This seems to be because the auto generated schema
graphql-env.d.ts
includes unknown for the basic typesDetails
I am using a GraphQl backend called "chaingraph" with the following URL: https://demo.chaingraph.cash/v1/graphql
This Url was also used to auto-generate the schema.
As you might see from the query, the project is a blockchain indexer.
Reproduction
I re-created a minimal repo for my issue called 'chaingraph-tada' https://github.com/mr-zwets/chaingraph-tada
Thanks
Thanks in advance 😄
Reproduction
https://github.com/mr-zwets/chaingraph-tada
gql.tada version
"gql.tada": "^1.8.2"
Validations