Commit Graph

5 Commits

Author SHA1 Message Date
Andy
2a9d2f8d59
Convert more "import *" to "import =" (#23446) 2018-02-05 18:27:31 -08:00
Tomek Łaziuk
5f07b0f39b [react-loadable] ability to import types which were unavailable (#23218)
* import/export

* contributors

* fix namespace
2018-01-31 12:15:55 -08:00
Ian Ker-Seymer
9f041991c6 Make react-loadable export an assignment (#22340)
* Make react-loadable export an assignment

`react-loadable` does *not* actually have a default export. This can be shown
by running:

```
> var L = require('react-loadable')
undefined
> L
{ [Function: Loadable]
  Map: [Function: LoadableMap],
  Capture:
   { [Function: Capture]
     propTypes: { report: [Function: bound checkType] },
     childContextTypes: { loadable: [Function: bound checkType] } },
  preloadAll: [Function],
  preloadReady: [Function] }
```

As a result, when attempting to use this with commonjs modules, an error error
is thrown when `allowSyntheticDefaultExports` is set.

```
TypeError: react_loadable_1.default is not a function
```

This PR exports the module as an assignment, so now `import * as Loadable from
'react-loadable'` should be used to import the module.

I am not entirely sure that I have used the best pattern for typings here; but
my goal was to export the proper assignment yet still allow all of the
namespace to be accessible via `(i.e.) Loadable.LoadingComponentProps`. If there
is a better way, please let me know and I will be happy to adjust!

* Use import assignment in react-loadable tests
2018-01-10 10:13:35 -08:00
Andy
5d6c651a1a Apply stricter lint rules (#19063) 2017-08-17 14:53:41 -07:00
Diogo Franco
2b0d0375e6 Add react-loadable TS2.4 tests (#17965)
* Add tests using import() to react-loadable

* Fix lint errors in react-loadable tests

* Add comment to react-loadable to clarify a common issue
2017-07-31 14:48:19 -07:00