Closed revmischa closed 11 months ago
Also getting this error from subscription-handshake-link.d.ts
node_modules/aws-appsync-subscription-link/lib/subscription-handshake-link.d.ts:17:5 - error TS2416: Property 'request' in type 'SubscriptionHandshakeLink' is not assignable to the same property in base type 'ApolloLink'.
Type '(operation: Operation) => Observable<unknown>' is not assignable to type '(operation: Operation, forward?: NextLink | undefined) => Observable<FetchResult<{ [key: string]: any; }, Record<string, any>, Record<string, any>>> | null'.
Type 'Observable<unknown>' is not assignable to type 'Observable<FetchResult<{ [key: string]: any; }, Record<string, any>, Record<string, any>>>'.
Type 'unknown' is not assignable to type 'FetchResult<{ [key: string]: any; }, Record<string, any>, Record<string, any>>'.
17 request(operation: Operation): Observable<unknown>;
~~~~~~~
[3:04:24 PM] Found 1 error. Watching for file changes.
Setting zen-observable-ts@0.8.19
at the top level package.json didn't seem to help much
$ npm ls zen-observable-ts
freezy@0.0.35 /Users/cyber/dev/freezy
├─┬ @apollo/client@3.4.16
│ └── zen-observable-ts@1.1.0
├─┬ @aws-amplify/ui-react@1.2.24
│ └─┬ @aws-amplify/ui-components@1.9.4
│ └─┬ aws-amplify@4.3.6
│ ├─┬ @aws-amplify/api@4.0.24
│ │ └─┬ @aws-amplify/api-graphql@2.2.13
│ │ └── zen-observable-ts@0.8.19 deduped
│ ├─┬ @aws-amplify/core@4.3.6
│ │ └── zen-observable-ts@0.8.19 deduped
│ ├─┬ @aws-amplify/datastore@3.6.0
│ │ └── zen-observable-ts@0.8.19 deduped
│ └─┬ @aws-amplify/pubsub@4.2.0
│ └── zen-observable-ts@0.8.19 deduped
└── zen-observable-ts@0.8.19
Hitting this issue myself. A pain since I'm not sure how to fix it without breaking something else...
Happened to me also. (using Angular 12+)
Can we please see how you are bringing in your Observable dependency from zen-observable-ts in the source code where the error is happening?
So I ran into this too...
To add to that, I believe it has to do with using typescript above version 4.4.4
I added type Observable<T> = unknown
to my types/index.d.ts and it solves the issue for now.
Just define it somewhere and you should be good.
I added the following import in my code (@types/index.d.ts) in order to declare the namespace "ZenObservable":
import "zen-observable";
Also as a quick fix, I used "patch-package" to patch the module "aws-appsync-subscription-link" with the following line (l. 17):
aws-appsync-subscription-link/lib/subscription-handshake-link.d.ts
## Replace "unknown" by "FetchResult"
request(operation: Operation): Observable<FetchResult>;
package.json
"dependencies": {
"@apollo/client": "3.5.8",
"aws-appsync-auth-link": "3.0.7",
"aws-appsync-subscription-link": "3.0.9"
},
"devDependencies": {
"patch-package": "^6.4.7"
}
I'm also running into this issue with react 17.0.2, and typescript 3.9.10, so I don't think it's just typescript 4 and above.
I have same problem in Angular 13
I have same problem in Angular 13
Yep, still on-going issue.
Same problem here, only way to get rid of this is currently
"skipLibCheck": true
in compilerOptions of tsconfig.json
We have published an RFC on our plan for improving TypeScript support in Amplify JS & would love to get your feedback & suggestions!
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
Authentication
Amplify Categories
auth
Environment information
Describe the bug
Installed amplify/auth and it won't compile:
I suspect the problem is conflicting versions of
zen-observable-ts
Expected behavior
Can compile
Reproduction steps
npm i @aws-amplify/ui-react tsc
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