vinzscam/react-native-file-viewer

Typescript definition broken

upngo opened this issue · 2 comments

upngo commented

index.d.ts does not have a default export and so attempting to call
import FileViewer from 'react-native-file-viewer'; shows
TS1192: Module '"/Users/..../work/......./node_modules/react-native-file-viewer/index"' has no default export.
and it is unusable.

If you delete the index.d.ts and rely on index.js then it works (but obviously no types)

Yes, true. I will fix this.

It looks you are facing the issue because you have allowSyntheticDefaultImports: false in your tsconfig.
In the meantime the following way of importing the package should also work for you:

import * as FileViewer from 'react-native-file-viewer'

Fixed by #123