mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
* 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
|
||
|---|---|---|
| .. | ||
| imports | ||
| index.tsx | ||