Require.js and typing
Hi,
I am working on a very javascript-heavy project that uses require.js.
I was surprised to learn, that Rider is able to detect some modules correctly and infer the type. But this does not work for all modules.
For "assert", rider got the type perfectly and autocompletion works like a charm. But for "ko" and "linq", it doesn't.
"assert.js" is very parser-friendly and I can see, how Rider gets the information.
"knockout.js" is much more complicated and the only way is probably to write the jsDoc manually.
But how do I have to put it into knockout.js?
Please sign in to leave a comment.
please could you share a test project the issue can be repeated with?
Thank you for the answer.
I uploaded a test project to my dropbox-account:
https://www.dropbox.com/sh/k03jnwg3dp7a1zk/AAD1ek5tuynCfTbXvOxU0_2ra?dl=0
The issue is in componentManager.js in line 4:
In my screenshot above, the setting "undeclare variable" is set to "error". That's why "observable" is red there and only underlined here.
Thanks! knockout-3.5.1.js is a compressed obfuscated version of a library, the IDE can't use it for code completion/resolving. Please try downloading knockout typings in Settings | Languages & Frameworks | JavaScript | Libraries:
Very nice! Thank you!
Can you also give me some hints, where I can add the typing for "libraries" that I create myself for use inside of my own project?
Just in case Rider cannot detect the resulting types itself.
it doesn't actually matter, you can put the d.ts files anywhere and add them as a library to your project using Settings | Languages & Frameworks | JavaScript | Libraries, Add...