react-split-pane icon indicating copy to clipboard operation
react-split-pane copied to clipboard

Ver 2 SplitPane & TypeScript - Import Declarations Broken

Open OceanAirdrop opened this issue 5 years ago • 0 comments
trafficstars

Overview of Problem

I am using the new version of react-split-pane. I went and installed the '@next' version as described in your readme file..

npm install react-split-pane@next

However, with this version, I can not import Pane in a typescript project. the Typescript compiler complains that "react-split-pane has no exported modules 'Pane'"

I am using this syntax:

import SplitPane, { Pane } from 'react-split-pane';

image

If I try to import Pane specifically from its file location like this:

import Pane from 'react-split-pane/lib/Pane'

I get the following typescript error: "could not find declaration file for module 'react-split-pane/lib/Pane.js'

image

My Work-Around Solution

In the end, my work-around solution was to include ts-ignore comments above each import statement to silence the TypeScript compiler

// @ts-ignore
import SplitPane from 'react-split-pane/lib/SplitPane';

// @ts-ignore
import Pane from 'react-split-pane/lib/Pane'

image

Expected behavior

I suspect the type definitions are not currently for Pane. Will this be added when V2 is released?

OceanAirdrop avatar May 11 '20 06:05 OceanAirdrop