Peter
11/26/2020, 7:00 PMexport type input = keyof QueryGetBtsArgs;
const getBts = async (_, arg) => {
const variables = {
...arg,
};
const data = await client(
endpoint,
gql`
query getBts($input: input) {
getBts(input: $input) {
province {
name
}
provider {
name
}
location {
name
}
}
}
`,
variables,
);
return data;
};
and my type QueryGetBtsArgs looks like this:
export type QueryGetBtsArgs = {
minLat?: Maybe<Scalars['Float']>;
maxLat?: Maybe<Scalars['Float']>;
minLong?: Maybe<Scalars['Float']>;
maxLong?: Maybe<Scalars['Float']>;
providers?: Maybe<Array<Maybe<ProviderEnum>>>;
technologies?: Maybe<Array<Maybe<TechnologyEnum>>>;
frequencies?: Maybe<Array<Maybe<FrequencyEnum>>>;
province?: Maybe<ProvinceEnum>;
location?: Maybe<Scalars['String']>;
skip?: Maybe<Scalars['Int']>;
};
I have error
Error: Unknown type "input". Did you mean "Int"?: {"response":{"errors":[{"message":"Unknown type \"input\". Did you mean \"Int\"?","locations":[{"line":2,"column":28}],"
how I should extend this args from QueryGetBtsArgs and pass it to query?
Thanks for help 😉Ryan
11/27/2020, 7:40 AMquery getBts($input: input) {
What is the type you see in the GraphQL Playground? You would need to add that here instead of input
as that is not a type declared anywhere.Peter
11/27/2020, 7:41 AMPeter
11/27/2020, 7:42 AMPeter
11/27/2020, 7:42 AMRyan
11/27/2020, 7:45 AMPeter
11/27/2020, 7:47 AMRyan
11/27/2020, 8:03 AMquery getBts(
$minLat: Int
$maxLat: Int
$minLong: Float
$maxLong: Float
... and so on
) {
}
Peter
11/27/2020, 8:37 AMRyan
11/27/2020, 8:54 AMPeter
11/27/2020, 8:55 AMPeter
11/27/2020, 8:56 AMPeter
11/27/2020, 8:58 AM