Problem with using with TypeScript (react-split-pane version: 0.1.76)
See original GitHub issuemy-app/node_modules/react-split-pane/index.d.ts
(53,1): An export assignment cannot be used in a module with other exported elements.
First, I’ve got this error on my existing app, which is quite big so I wanted to reproduce it in fresh app.
I created completely new typescript project using create-react-app my-app --scripts-version=react-scripts-ts and then just import react-split-pane:
import SplitPane from 'react-split-pane';
Compiler error points to the 53 line of index.d.ts, which is:
export = SplitPane;
I also tried importing the other ways:
const SplitPane = require('react-split-pane');
import {default as SplitPane} from 'react-split-pane';
import * as SplitPane from 'react-split-pane;
So I assume there is a problem on react-split-pane side.
I am using newest TypeScript version published on npm which is 2.6.2 at the moment.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:7 (2 by maintainers)
Top Results From Across the Web
react-split-pane - npm
Latest version: 0.1.92, last published: 2 years ago. Start using react-split-pane in your project by running `npm i react-split-pane`.
Read more >@types/react-split-pane examples - CodeSandbox
Learn how to use @types/react-split-pane by viewing and forking @types/react-split-pane example apps on CodeSandbox.
Read more >@types/react-split-pane | Yarn - Package Manager
Fast, reliable, and secure dependency management.
Read more >Split Pane - npm - Socket.dev
Bucklescript bindings for react-split-pane ... Angular UI library to split views and allow dragging to resize areas using CSS flexbox layout.
Read more >Could not find a declaration file for module error in react
others have imported it also same way as i did : github.com/tomkp/react-split-pane/issues/233 · They probably are not using typescript. · is there ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@kierson are you sure that fix is correct? Typescript compiles fine with the current type definition, but at runtime I’m facing this error:
Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports..This is caused by react-split-pane, it looks like SplitPane is undefined or something. Not really sure how to fix this. It still worked before the type definitions where moved from DefinitlyTyped to this repo,.
For some reason the npm package of version 0.1.77 has these two lines at the end of
lib/SplitPane.js:There’s something wrong there as the exports object is modified and then overwritten… Commenting out the last line fixes things.