Aws-mobile-appsync-sdk-js: Upgrade to latest redux-offline

Created on 30 Oct 2018  路  3Comments  路  Source: awslabs/aws-mobile-appsync-sdk-js

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

feature-request

Most helpful comment

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

``Type error: Could not find a declaration file for module '@redux-offline/redux-offline/lib/types'. '/Users/nikolay/workspace/work/progressive-dynamics/frontend/node_modules/aws-appsync/node_modules/@redux-offline/redux-offline/lib/types.js' implicitly has an 'any' type. Trynpm install @types/redux-offline__redux-offlineif it exists or add a new declaration (.d.ts) file containingdeclare 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: (clientGetter: () => AWSAppSyncClient, persistCallback: () => any, dataIdFromObject: (obj: any) => string, storage: any, callback?: OfflineCallback) => Store;
6 | export declare type OfflineEffectConfig = {
7 | enqueueAction: string;```

All 3 comments

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

``Type error: Could not find a declaration file for module '@redux-offline/redux-offline/lib/types'. '/Users/nikolay/workspace/work/progressive-dynamics/frontend/node_modules/aws-appsync/node_modules/@redux-offline/redux-offline/lib/types.js' implicitly has an 'any' type. Trynpm install @types/redux-offline__redux-offlineif it exists or add a new declaration (.d.ts) file containingdeclare 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: (clientGetter: () => AWSAppSyncClient, persistCallback: () => any, dataIdFromObject: (obj: any) => string, storage: any, callback?: OfflineCallback) => Store;
6 | export declare type OfflineEffectConfig = {
7 | enqueueAction: string;```

A workaround, for the interim.

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;
}
Was this page helpful?
0 / 5 - 0 ratings