TypeScript Error - TS7016 - (TS) Could not find a declaration file for module 'redux-localstorage' -
i have upgraded environment typescript 2.4.1 , have turned "strict": true,
in tsconfig.json. love strict null checking, it's soooo cool but, i’m running brick wall redux stuff i’m using. i’m using module ‘redux-localstorage’ installed through npm. it’s old , out of date new typescript compiler , working no issues. throwing error, “ts7016 - (ts) not find declaration file module 'redux-localstorage'.”
i found ‘@types/ redux-localstorage’ but, seems, done older version of module different parameters have. stated, know module works, it’s not working strict type checks.
the thing is, i’m calling module 1 .ts file and, using 1 function. so, @ top of .ts file have import statement:
import persiststate 'redux-localstorage';
this statement worked fine before updated newer typescript , turned on strict checking but, stated error.
i have 2 questions know quick , easy fix? don’t want turn off strict checking (i assume causing issue). maybe there way turn off file?
second question is, if there no “quick fix” can write own ‘.d.ts’ file module, 1 function. if can give me pointers how? stated, need create type 1 function.
update - have solved problem
i created type file:
// type definitions redux-localstorage persiststate, until better solution becomes available import * redux "redux"; export interface configrs { key: string; merge?: any; slicer?: any; serialize: (value: any, replacer?: (key: string, value: any) => any, space?: string | number) => string, deserialize: (text: string, reviver?: (key: any, value: any) => any) => } export default function persiststate(paths: string | string[], config: configrs): redux.genericstoreenhancer;
i had add file filename index.d.ts node_modules/@types/redux-localstorage
directory
thanks suggestions....
Comments
Post a Comment