JSDoc tag for JSRecord

Hi, I have this code:

var incFS = databaseManager.getFoundSet(forms.Incidencia.controller.getDataSource());
incFS.loadRecords("select id_incidencia from " + databaseManager.getDataSourceTableName(controller.getDataSource()) + " where id_incidencia = " + incidencia_id)
var inc = incFS.getRecord(1);

If I don’t set the JSDoc tag for inc var, if I put this code:

var x = inc.id_incidencia

I receive this warning:

The property id_incidencia is undefined for the type JSRecord

Ok. Then I put this:

/** @type {JSRecord<db:/dbserver/incidencias>}*/

It’s fine, but then databaseManager.getDataSourceTableName(controller.getDataSource()) is useless because I have to put the server and table names in the tag! If I change the source of the form, the code works fine, but I will receive a jsdoc warning again.

Just keep in mind that JSDoc are only there to let the editor know the properties for that table. As JSDoc is just a comment line will not take effect in the running code, it is used just to check you do not make typos while writting your code.

if you call:

databaseManager.getFoundSet(xxxx)

then the script editor has no idea what kind of foundset you return there.
Because xxx is just a string that can come from anywhere (so in your example controller.getDataSource())

so you have to type the foundset (or record what you do) that you get out of that call yourself if you know the datasource to be able to validate or code complete it.

Or be use the record dynamic:

var x = inc['id_incidencia']