Generating .d.ts file for react-dropdown-tree-select.js module - reactjs

I am fairly new to react and typescript. I have included the dropdown tree select in my project but it is missing the index.d.ts file in the #types\react-dropdown-tree-select folder. I am not really sure how to generate or make one (not sure of the contents). I tried the dts-gen, but it gives an error as "Couldn't load module "react-dropdown-tree-select". Please install it globally (npm install -g react-dropdown-tree-select) and try again." Even when I have installed it globally.

react-dropdown-tree-select author here.
Currently react-dropdown-tree-select doesn't have any typings, simply because no one ever created them. However, I can see how this can be important for TS users. If you'd like to submit a PR or collaborate on creating typings, I'd be glad to answer any questions you may have.
Thanks for your interest in this component.

Related

Why my package is not correctly exported in node_modules after build in pnpm monorepo

First of all, let me apologize if I make so many mistakes in this posts, since I don't really understand how dependencies work and how monorepos are handled (I am trying :P ).
I am currently using a huge monorepo with 12 packages and 2 apps. It is working with no problems with yarn, but I am considering migrating to pnpm specially because of performance issues and to decrease how long it takes to install.
My current problem is that pnpm is way more strict, so I am getting an error regarding to another subpackage not exporting something.
src/components/StatusBall.tsx:6:3 - error TS2305: Module '"../../node_modules/services/lib/status"' has no exported member 'serverID'.
6 serverID,
~~~~~~~~~~~~~~~~~
This is not exactly correct, if I go to the "services" package lib (dist) folder, it is properly compiled, but If i go to StatusBall and I use ctrl+click it sends me to
...frontend\node_modules\.pnpm\#focus+services#1.15.1_sfoxds7t5ydpegc3knd667wn6m\node_modules\services\lib\status\index.d.ts
But this file is missing the export serverId I can see in my lib folder.
What is wrong? Am I missing something?

Cannot Find Module 'block-stream'

I'm trying to make a new react-js site using npx create-react-app
The Error I get is Error: Cannot find module 'block-stream'
I redownloaded node and tried again but still getting the same error
what can I try to fix this?
Correct me if I'm wrong on anything here, I'm not really a React or Node developer.
However, I'd guess, if it's an addon or additional package, it may not be installed by default. You might try figuring out if you can install it, somehow.
I don't know if this is what you meant, but I did find this webpage with some details on installing it.
In addition, if you don't want to use blockstream, and didn't intentionally include it, and this error is being shown to you for seemingly no reason, I'd suggest looking through your codebase to find any references to that code.
I wish you luck :)

How to check if a create-react-app project has been ejected or not?

I'm working on a project built by someone else. I know it was bootstrapped by create-react-app because it says so in README.md.
However, I'm not sure if it has been ejected or not. There are many posts out there teaching you how to actually eject it, but I failed to find a way to check it in the first place. Any help is appreciated!
Some immediate giveaways that a create-react-app project has been ejected:
The dependencies field in package.json no longer contains react-scripts. Instead, it is populated with many additional packages like Babel, Eslint, Jess, Webpack and various Webpack loaders.
The absence of eject script.
The start, build and test no longer follows this format react-scripts start, react-scripts build etc.
A new directory named config appears.
Just sharing because you may or may not see all of these signs in your project as they were probably ejected a long time ago. I hope no one will spend two hours wondering why a certain package didn't work only to discover that the project has been ejected and the package only works with unejected ones.
Many thanks to #YuryTarabanko!
So I tried creating another project using CRA and ejecting it. Right after the ejection, a new directory called config popped up and there were some modifications in other directories, too.
Then I took a look at the project I'm actually interested in. The config directory is right there, with a structure similar to that config dir in the new project that popped up after the ejection. So I'm sure this project has been ejected, too!
Edit:
As Yuri pointed out in the comment:
The most noticeable difference IMHO would be the absence of eject command in package.json#scripts section though ;)
I somewhat agree with the script in package.json, but it could have easily been removed. If the project is in a repo, you should be able to look at the history of a few files to be certain.

How to add dependencies to angularJS project without NPM

I've inherited an angularjs project and am trying to understand how it's structured and ultimately am trying to add dependencies to it manually. The project structure is below.
It seems like it was created without NPM (notice no package.json files - is my understanding correct about this?). The angular components (ie. our custom code) are in the components folder. The assets has external dependencies, eg. PDFViewer, JWT and other dependencies. Does this mean it's likely the assets were manually copied over, instead of managed by a tool?
Ultimately I want to add a new dependency to the project, specifically this ImageViewer library. Without NPM, I'm clueless about how to do this. Can I add npm to a pre-existing project like this or not? If not, the directions show this alternative.
Does this mean I don't have to manually put anything in the assets folder? I just put these references in app.js and it should pick them up? And then I obviously have to define ImageViewer somewhere in angular module or something to bring it into the project. Or am I completely wrong about all this? I don't know anything on how to manage JS dependencies w/o NPM so any recommendations here are super welcomed!
I would recommend using npm to manage your dependencies where possible as this will make your life easier when it comes to upgrading versions etc.
You can just copy and paste the js files into the assets folder and reference them in your index.html file by using a script tag though, if you want to go that route. This will make the exported object available globally within your application (which may or may not be what you want).
The snippet you've posted above has the script source pointing to an external url, so you don't have to copy and paste anything locally, however your application then has an external dependency on that URL being up and available when your application runs, so that is something to keep in mind as well.
I would recommend trying to go over to using npm to manage your dependencies. It is absolutely possible to just run npm init in the project and to start adding dependencies this way as well. Both approaches can work side by side.

Using Quick Install in Visual Studio doesn't actually add the packages to your project

Hello I'm trying to use the Visual Studio extension Quick Install Package to install packages via bower and npm. One example is angular-loading-spinner
When I give the command using the interface, I see that the package.json file is updated and or the bower.json file is updated with the package dependency, but I'm still unable to actually reference the packages as instructed in my html using the tags. No actual files are added to the project, so I feel like I'm really missing something here, or simply don't understand what this package installer is actually meant to do. There doesn't seem to be any clear tutorial on this I can find online, or any good information. It just all assumes it works fine. Can anyone please advise? Thanks]1
Mike, I'm glad to know that my answer was the correct. For future users that have the same concern, they need to look at the folder node_modules to find out all the libraries installed.
This was put in the node_modules folder as pointed out by Jonathan Brizio. The issue was that the files were hidden and had to be included in the project.

Resources