Filip
Filip

Reputation: 323

Could not find a declaration file for module 'react-split'

I am trying to make a split view and I have problems importing react-split.

When I import and add it to my code I don't see any problems. Then, I see that in my editor on the line import Split from "react-split" there are three points and when I hover them it says:

Could not find a declaration file for module 'react-split'. '/home/user/Documents/test/node_modules/react-split/dist/react-split.js' implicitly has an 'any' type. Try npm install @types/react-split if it exists or add a new declaration (.d.ts) file containing declare module 'react-split';ts(7016)

If I try and run npm install @types/react-split I get

npm ERR! code E404 npm ERR! 404 Not Found - GET https://registry.npmjs.org/@types%2freact-split - Not found npm ERR! 404 npm ERR! 404 '@types/react-split@latest' is not in the npm registry. npm ERR! 404 You should bug the author to publish it (or use the name yourself!) npm ERR! 404 npm ERR! 404 Note that you can also install from a npm ERR! 404 tarball, folder, http url, or git url.

When I create a .d.ts file and i declare the module I still don't get this problem resolved and the message stays there.

Any idea how to fix this? I tried everything that was suggested and saw some similar stack questions but nothing that fixes.

Edit: I am pretty new to web dev, it seems that it asks for typescript? I wonder why? I installed typescript but the package is still not working

Upvotes: 5

Views: 1981

Answers (2)

Rogelio Triviño
Rogelio Triviño

Reputation: 6519

It seems they have pending to release this file: https://github.com/nathancahill/split/blob/8a51b9d79b44f8fa602cf2bf984c5408f43308b9/packages/react-split/index.d.ts

just download it to your node-modules/react-split folder, for me was enough

Upvotes: 1

Roy.B
Roy.B

Reputation: 2106

@types/react-split-pane has been deprecated

you should use react-split-pane

react-split-pane provides its own type definitions, so you don't need @types/react-split-pane installed

Upvotes: 1

Related Questions