Misaligned TypeScript definition: abusive named export ReactNativeBlobUtil (not actually exported)
Hello,
The TypeScript definition (abusively) exports a const named "ReactNativeBlobUtil" as well as the default export, while the index.js does not export it.
When using eslint-plugin-import, the default import/no-named-as-default rule warns users to use the named export instead.
It typechecks, but ReactNativeBlobUtil is undefined at runtime.
This is rather easy to fix: the types definition should be aligned with the module source code (either removing the export of the named ReactNativeBlobUtil const, or adding the export statement in JS)
Please provide the version of installed library and RN project.
-
react-native:0.65.1 -
react-native-blob-util:0.13.18
A sample code snippet/repository is very helpful to spotting the problem.
// This typechecks, since the types export a named const "ReactNativeBlobUtil"
import { ReactNativeBlobUtil } from 'react-native-blob-util';
// LOG ReactNativeBlobUtil undefined
console.log('ReactNativeBlobUtil', typeof ReactNativeBlobUtil);
This work fine (but eslint will complain if import/no-named-as-default is enabled)
// eslint-disable-next-line import/no-named-as-default
import ReactNativeBlobUtil from 'react-native-blob-util';
// LOG ReactNativeBlobUtil object
console.log('ReactNativeBlobUtil', typeof ReactNativeBlobUtil);