Does anyone know or has a JSDOC definition library I can use for SS2.0??
The current one I have for SS1.0 looks like the one below, and I use it to plug into my IDE and get autocompletion.
/** * Loads an existing saved search. The saved search could have been created using the UI, or created using nlapiCreateSearch(type, filters, columns) in conjunction with nlobjSearch.saveSearch(title, scriptId).
*<br>API Governance: 5
* @param {String} recType [optional] - The record internal ID of the record type you are searching (for example, customer|lead|prospect|partner|vendor|contact). This parameter is case-insensitive.
* @param {String} searchId - The internal ID or script ID of the saved search. The script ID of the saved search is required, regardless of whether you specify the search type. If you do not specify the search type, you must set type to null and then set the script/search ID.
* @returns {nlobjSearch} nlobjSearch
* @since 2012.1 */
function nlapiLoadSearch(recType, searchId) { };
Not really a technical question but would come in handy for everyone.
The way SS2 works you are essentially out of luck.
consider
What is bob? Your IDE will have to be considerably smarter to know that bob is part of the search namespace. It's of course doable but less likely to work with a simple downloadable file that you can just plug into your IDE. If you just use 'search' that may make things more likely to work but now you've used up a very generic name that you cannot use elsewhere.
Also if an IDE can determine what 'bob' is now your arguments is an unordered hash so positional @params don't work anymore.
Typescript may help. I've been maintaining a Typescript definition file for SS1 at https://github.com/BKnights/KotN-Netsuite. As I start doing more with SS2.0 I may do the same for that. Then your IDE would have more of a chance:
So your Typescript aware IDE could use that for member completion and at least you'd have a compile time check on types
You may consider what I did which there is no need to download other plugins.
You will be able to enable the code assist if you have the copy of SS2.0 API and then use "@param" and "@type" JSDOC tag.
Then, there will be suggestion every time you type then 'CTRL' + 'SPACE".
Aside from that, your IDE will also provide description for each function.
So this is what will you do.
Next to enable the code assist for object constructor APIs of SS2.0 like 'N/record' and 'N/search' modules, we should be adding "@param" JSDoc tag on each function declaration.
So if we are going to use the 'N/record', 'N/search' and 'N/error' modules in our script, we should have below sample comments before function declaration. But please take note that it should match the value inside the "{[VALUE HERE]}" tag and the module name. Also the variable name on the comment section and function declaration.
You may also use '@type' for your variable declaration. Below is the sample code.