[TypeScript] problem with Chai imports autocompletion

Hello everyone, 

 

I have a little issue with Chai assertion library in typescript. I have no autocompletion for Chai. (I'm creating a nodeJS API)

Everything works perfectly, i can build, run my tests etc..

 

But IntelliJ seems to be unable to recognize chai when i'm writing my tests (no autocomplete at all)

I've tried to add community stubs in javascript libraries (in prefetences), but no luck.

 

Does this rings a bell to someone? :)

 

thanks for reading this post


0
4 comments

works fine for me (webstorm 2018.2.3):

My steps:

- npm i chai

- added `assert` import

- installed typings by hitting Alt+Enter on imported module and choosing Install TypeScript definitions for better type information intention (https://www.jetbrains.com/help/webstorm/configuring-javascript-libraries.html#ws_jsconfigure_libraries_ts_definition_files)

1
Avatar
Permanently deleted user

Hi Elena, sorry for the late answer,

 

I have indeed tested chai imports in another (dummy) project and everything works as expected. The problem is in my project (configuration maybe?).

 

Saddly i'm not able to find out why chai exports aren't recognized for this particular project. I could try to create another project from scratch and copy/paste my code to see where or when this issue is happening. 

 

Any other suggestions? (I'll post a solution if i find one)

0

ctrl+click on assert - what definition are you taken to? Also, did you try invalidating caches (File |Invalidate caches, Invalidate and restart)?

0
Avatar
Permanently deleted user

I have a similar problem, but a bit different. Webstorm recognizes Chai, but wont suggest imports... I have to write them by hand (or copy paste). Does someone has a similar issue?

0

Please sign in to leave a comment.