I'm using aws-appsync
library and I'm getting this error:
(4,42): Could not find a declaration file for module '@redux-offline/redux-offline/lib/types'. 'node_modules/aws-appsync/node_modules/@redux-offline/redux-offline/lib/types.js' implicitly has an 'any' type. Try
npm install @types/redux-offline__redux-offline
if it exists or add a new declaration (.d.ts) file containingdeclare module '@redux-offline/redux-offline/lib/types';
Then I added declare module @redux-offline/redux-offline/lib/types;
to my typings.d.ts
to check if that error goes away but I got other:
/node_modules/aws-appsync/lib/store.d.ts (13,69): Cannot use namespace 'NetworkCallback' as a type.
Now I don't know how to fix the last error because I didn't find many pieces of information about it on the internet.
I don't know if this is important, but packages/web/node_modules/@redux-offline/redux-offline/lib/types.js
is a file only with "use strict";
line.
A solution that works is setting noImplicitAny: false
, but I've read about it and it's not a good one.
Thank you!
So I open the file /node_modules/aws-appsync/lib/store.d.ts
and there are two types imported from @redux-offline/redux-offline/lib/types
:
import { NetInfo, NetworkCallback } from '@redux-offline/redux-offline/lib/types';
Then in typings.d.ts
I just added:
declare module '@redux-offline/redux-offline/lib/types' {
export type NetInfo = any;
export type NetworkCallback = any;
}
and the problem was gone.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With