#✅ - ambiguous indirect export: GraphQLQuery

1 messages · Page 1 of 1 (latest)

buoyant nebula
#

I'm using Nuxt3 and Vite (which use VueJS behind the scenes), and I get this error when trying to construct a GraphQL query.

import { API, graphqlOperation } from 'aws-amplify';
import { listComments } from '~/src/graphql/queries';
import { ListCommentsQuery } from '~/src/graphql/queries';
import { GraphQLQuery } from '@aws-amplify/api-graphql';
// I've also tried: import { GraphQLQuery } from '@aws-amplify/api';
const comments = API.graphql < GraphQLQuery < ListCommentsQuery >> (
    graphqlOperation(listComments)
)
console.log(comments)

Error:

ambiguous indirect export: GraphQLQuery
shrewd plaza
#

can you try the imports like below

#

import { API } from 'aws-amplify';
import { listComments } from '~/src/graphql/queries';
import { ListCommentsQuery } from '~/src/graphql/queries';

shrewd plaza
#

try chaning the graphql call const comments = await API.graphql({
query: listComments
});

buoyant nebula
#

It works

#

But doesn't that leave me without Type checks?

shrewd plaza
#

it will take the default type from the query.js

buoyant nebula
#

I'll have to live with that I guess

shrewd plaza
#

By default, the comments model type will be used in this case.

buoyant nebula
#

@shrewd plaza Sorry for the confusion, it was my absolute fault, I was on a .JS script, while I thought I was on a TS file

charred finchBOT
#

✅ - ambiguous indirect export: GraphQLQuery

#

Marked as solved.