You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
API.graphql() return type is Promise<GraphQLResult> | Observable<object>.
Although, when using amplify the errors object on a GraphQLResult does not conform to the type GraphQLError[] as defined by GraphQLResult.
The following properties exist on the errors object that are not in the type : errorInfo, errorType.
Expected behavior
I expect the type returned by API.graphql() to allow the addition of the errorInfo and errorType attributes so that I can act on them in a typescript project using amplify.
Reproduction steps
npm install aws-amplify
import API from aws-amplify
Make a call to graphql and try to act on errorInfo and errorType
Code Snippet
// Put your code below this line.(API.graphql({query: someQuery,// we have to narrow the type as it can return an Observable for subscriptions})asPromise<GraphQLResult<object>>).then((result)=>{// below typescript error for errorType, see screenshotconsole.log(result.errors?.errorType);});
Log output
// Put your logs below this line
Property 'errorType' does not exist on type 'GraphQLError[]'.ts(2339)
aws-exports.js
No response
Manual configuration
No response
Additional configuration
No response
Mobile Device
No response
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
No response
The text was updated successfully, but these errors were encountered:
With the release of the latest major version of Amplify (aws-amplify@>6), this issue should now be resolved! Please refer to our release announcement, migration guide, and documentation for more information.
Before opening, please confirm:
JavaScript Framework
React
Amplify APIs
GraphQL API
Amplify Categories
api
Environment information
Describe the bug
API.graphql()
return type isPromise<GraphQLResult> | Observable<object>
.Although, when using
amplify
theerrors
object on aGraphQLResult
does not conform to the typeGraphQLError[]
as defined byGraphQLResult
.The following properties exist on the
errors
object that are not in the type :errorInfo
,errorType
.Expected behavior
I expect the type returned by
API.graphql()
to allow the addition of theerrorInfo
anderrorType
attributes so that I can act on them in a typescript project using amplify.Reproduction steps
aws-amplify
API
fromaws-amplify
graphql
and try to act onerrorInfo
anderrorType
Code Snippet
Log output
aws-exports.js
No response
Manual configuration
No response
Additional configuration
No response
Mobile Device
No response
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
No response
The text was updated successfully, but these errors were encountered: