PhpStorm 2018.2 javascript code invalid autocomplete - javascript

Two questions:
1.
Why code autocomplete is showing me .set methods from other libraries while having proper import from particular one (screenshot)?
2.
Why, while importing lodash, I have "Cannot resolve symbol" in here?
I know, that to prevent from displaying this warning I need to load #types/lodash in Javascript libraries settings, but... why this information is not loaded automatically from node_modules directory?

Related

How to Clear this "Type annotations can only be used in TypeScript files.ts(8010)" error in VSCODE

I am using nest js as my backend and i get this type annotation error often. I am unable to solve this error. The file extension by default is .ts file. I even get this error when i use React with typecript. Is there any other options to solve this problem without disabling the validation.
I have tried disabling the typescript validation as some of the articles and Q&A suggest. But whats the use of disabling it when we use the typescript. I tried reinstalling the typecript and ESLInt too.
Make sure your language in the bottom right window angle is set to TS
What exactly you did to lose it? you haven't provided links to what you did

How to import Javascript package in browser via script tag or similar

I know I'm a bit behind the times here, but how can I import from this library (uirouter/react-hybrid) for an existing Angularjs site using only tags to include libraries? I have tried a few things, including including from CDN via jsdelivr, also building from node locally and attempting to include the dependencies via webpack. I have also tried loading through require.js but not sure I did it correctly. No matter what, I either get an error for the import or I fail to see the library once imported. I am just not getting it, I feel like I'm missing something. Could someone please help me with a detailed process for how I can get this library to work in place of the existing angular ui-router loaded via tag?
I could definitely go into the reasons why I'm doing this in the first place if necessary, but I feel like this should be pretty simple and I'm just struggling.
Thanks.

WebStorm autocomplete for npm modues

I recently started following a course about Node.js. I have an issue in WebStorm. I am trying to explore the validator module. The autocomplete in WebStorm doesn't give me choices for methods unless I select the default in the drop-down list which is unusual across all programming languages including JS !!! is it an issue and if yes what is the solution?
The problems occur because of the weird way properties are defined.
Normally installing Typescript stubs can be used as a workaround. But this doesn't work for validator due to WEB-43528. Please follow this ticket for updates
Using import validator from "./validator"; instead of require() can be used as a workaround

Adding watermark.js to angular 4

Hi I am trying to add watermark to the image and i am trying to include watermark.js to the angular 4. Could someone please tell me how to include watermark.js in angular. I tried installing using
npm install watermark -save
and then using the
import * as watermark from 'watermark';
but the above line throws me an error stating cannot find module 'watermark'
can someone please tell how i can import the watermark.js and use it to watermark my image?
You're missing type definitions for watermark.js. However, judging by this github issue, the authors of this lib currently don't offer them.
You have a couple of possibilities to fix this:
Declare type definition manually. This is the quickest way, but you'll also lose all type safety when it comes to using this lib
Help with creating proper type definitions (as shown in this tutorial). This way you'll be type safe, learn a lot about the TS type system, and, as a bonus, contribute back to the OSS community.
Good luck!

Bootstrap modal() Undefined is not a function with npm modules

I am getting an error when I try to call $("#myDiv").modal(). The error is:
Uncaught TypeError: undefined is not a function
I have seen this error come from a few different places, and modal() is called with different parameters in the various places. I've seen a lot of questions that say the solution is to include the jquery and bootstrap files in the right order. I find this confusing because I am using jquery and bootstrap npm modules, so I don't include their js files anywhere. How can I get this to work with npm modules?
This issued might be resolved. But I am adding the solution for future reference.
Try checking if the bootstarp jQuery library is included. This problem might be because of a situation where you also include a jQuery library into the web page along with the existing bootstrap jQuery library. Bootstrap will always reference the first included jQuery.
.modal() is included into bootstrap's jQuery. So try including that before.

Categories

Resources