awslabs / aws-mobile-appsync-sdk-js

JavaScript library files for Offline, Sync, Sigv4. includes support for React Native
Apache License 2.0
921 stars 266 forks source link

Upgrade to latest redux-offline #280

Open manueliglesias opened 6 years ago

manueliglesias commented 6 years ago

We need to upgrade to the latest redux-offline, see #276

kaievns commented 5 years ago

any chances this will be fixed any time soon? it is still borked in appsync 1.7.0, doesn't work in typescript:


  Try `npm install @types/redux-offline__redux-offline` if it exists or add a new declaration (.d.ts) file containing `declare module '@redux-offline/redux-offline/lib/types';`  TS7016

    2 | import { AWSAppSyncClient, OfflineCallback } from './client';
    3 | import { NormalizedCacheObject, IdGetter } from 'apollo-cache-inmemory';
  > 4 | import { NetInfo, NetworkCallback } from '@redux-offline/redux-offline/lib/types';
      |                                          ^
    5 | declare const newStore: <TCacheShape extends NormalizedCacheObject>(clientGetter: () => AWSAppSyncClient<TCacheShape>, persistCallback: () => any, dataIdFromObject: (obj: any) => string, storage: any, callback?: OfflineCallback) => Store<any>;
    6 | export declare type OfflineEffectConfig = {
    7 |     enqueueAction: string;```
AndrewKvalheim commented 5 years ago

A workaround, for the interim.

ajhool commented 3 years ago

This issue breaks typescript compilation for any project using aws-appsync. @AndrewKvalheim 's solution works, for convenience, directly adding the code here:

Place a typings.d.ts file at project root:

declare module '@redux-offline/redux-offline/lib/types' {
  export type NetInfo = any;
  export type NetworkCallback = any;
}