question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Problem with using with TypeScript (react-split-pane version: 0.1.76)

See original GitHub issue
my-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:open
  • Created 6 years ago
  • Reactions:2
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
WernerLDevcommented, Feb 25, 2018

@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,.

1reaction
eug48commented, Jun 5, 2018

For some reason the npm package of version 0.1.77 has these two lines at the end of lib/SplitPane.js:

exports.default = SplitPane;
module.exports = exports['default'];

There’s something wrong there as the exports object is modified and then overwritten… Commenting out the last line fixes things.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found