Does anyone know where to find a SS2.0 JSDOC definition library?

后端 未结 2 529
盖世英雄少女心
盖世英雄少女心 2021-01-14 13:06

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

2条回答
  •  深忆病人
    2021-01-14 13:55

    The way SS2 works you are essentially out of luck.

    consider

    define(['N/search'], function(bob){
        var srch = bob.load({id:'customsearch_my_search'});
    }
    

    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:

    define(['N/search'], function(bob:NSearch){...
    

    So your Typescript aware IDE could use that for member completion and at least you'd have a compile time check on types

提交回复
热议问题