Closed MathieuLorber closed 8 years ago
import ModuleName from ...
and export default
is ES6 code that babel transpiles to module.exports
. I'm sticking Common JS modules for now. This change would make it not work for many people.
Ok, turned out I just had to use import * as Dimensions from 'react-dimensions';
=x
BTW, I wrote a (partial) Typescript definition file, I'll probably take time to make it exhaustive & submit it to DefinitelyTyped.
[Disclosure] I'm really not an expert of ES6/node module internals. I'm using react-dimensions on a project that I'm moving step-by-step to TypeScript. With the current code
import Dimensions from 'react-dimensions';
will import the function as expected in ES6/Babel code, but will be undefined with TypeScript. This patch fixes the problem.