# Custom JSDoc Type declarations

**URL:** <https://forum.servoy.com/t/custom-jsdoc-type-declarations/16759>\
**Category:** Classic Servoy\
**Created:** [November 19, 2012, 4:59pm UTC](https://forum.servoy.com/t/custom-jsdoc-type-declarations/16759 "2012-11-19T16:59:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jgarfield](https://avatars.discourse-cdn.com/v4/letter/j/7ea924/32.png) [@jgarfield](https://forum.servoy.com/u/jgarfield)\
**Post date:** [November 19, 2012, 4:59pm UTC](https://forum.servoy.com/t/custom-jsdoc-type-declarations/16759/1 "2012-11-19T16:59:37Z")

</div>

When annotating code with the new and wonderfully enhanced JSDoc capabilities in Servoy 6x, is it possible to have custom types?

For example I know ```  
@param {Array} myVar

````will

I also know you can get fancy and do ```
@return {{x:Number, y:Number}}
``` and functions that retrieve that return value will be able to code complete with obj.x and obj.y.

Lt us, however, pretend for just a moment, that we have some relatively complex types; e.g ```
@return {{query:String, qArg:Array, holder:Object, server:String, ...}}
``` This is even a relatively simple example, but it one that could be used in numerous places all throughout code, both as an argument and as a return value. 

It will quickly become somewhat tiresome to need to repetitively type this out. Yes, I know, Eclipse templates, and no, I don't think this is a solution that scales well.

Is there a way to define this as a custom type such that you would be able to do something along the lines of ```
@param {SQL} mySQL
``` or even something crafty along the lines of perhaps ```
@param {scopes.sql.sqlObject}
``` where sqlObject is is either a function that returns that type or an annotated object with the desired structure?
````

---

<div class="post-metadata">

**Author:** ![patrick](https://avatars.discourse-cdn.com/v4/letter/p/b2d939/32.png) [@patrick](https://forum.servoy.com/u/patrick)\
**Post date:** [November 19, 2012, 9:06pm UTC](https://forum.servoy.com/t/custom-jsdoc-type-declarations/16759/2 "2012-11-19T21:06:52Z")

</div>

Have you actually tried to use

@param {scopes.sql.sqlObject}

?

We use it all over the place and it works just fine. And for this

@return {{query:String, qArg:Array, holder:Object, server:String, …}}

you could simply define an object in some scope and use it as above.

---

<div class="post-metadata">

**Author:** ![jgarfield](https://avatars.discourse-cdn.com/v4/letter/j/7ea924/32.png) [@jgarfield](https://forum.servoy.com/u/jgarfield)\
**Post date:** [November 19, 2012, 9:30pm UTC](https://forum.servoy.com/t/custom-jsdoc-type-declarations/16759/3 "2012-11-19T21:30:48Z")

</div>

Excellent!  
I hadn’t actually tried it yet, but couldn’t find any documentation to the effect, so figured it was worth asking.

Thanks!
