graphql Typescript build failure on strict mode #8983
Labels
bug
Something isn't working
Build
Related to build issues
GraphQL
Related to GraphQL API issues
TypeScript
Related to TypeScript issues
Before opening, please confirm:
JavaScript Framework
Angular
Amplify APIs
Authentication, GraphQL API
Amplify Categories
auth, function
Environment information
Describe the bug
When TypeScript strict mode is on, ie.
"strict": true
is set ontsconfig.json
, TypeScript will emit the following errors:This is because the
graphql
version onaws-amplify
is pinned to 14.0.0 (src) that does not have type declaration. This is resolved in graphql/graphql-js#2102, which adds TypeScript typings in their source files and was released in 14.5.0. Note that@types/graphql
has been deprecated as part of the graphql/graphql-js#2102 change.We should look to upgrade to 14.5.0 after validating for possible regressions.
Workaround
As a workaround, customer can write their own
types.d.ts
with the following contentor they can install the deprecated
@types/graphql@14
, which will give them npm warnings.related: #2365, closed by stalebot.
Expected behavior
No graphql types error should be present when typescript strict mode is on.
Reproduction steps
This is reproducible from getting started guide for Angular, which turns on Strict Mode by default on the latest Angular cli. https://docs.amplify.aws/start/getting-started/installation/q/integration/angular/
I also provided a reproducible repo below.
Code Snippet
Repo Link: https://github.com/wlee221/amplify-angular-12/tree/without-workaround
will show you the error.
Log output
The text was updated successfully, but these errors were encountered: