You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by "Christian Lenz (JIRA)" <ji...@apache.org> on 2017/11/27 17:15:00 UTC

[jira] [Updated] (NETBEANS-184) Please add feature to check types via JSDoc

     [ https://issues.apache.org/jira/browse/NETBEANS-184?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Christian Lenz updated NETBEANS-184:
------------------------------------
    Description: 
I have this piece of code:

{code}
/**
 * @param {Number} name description
 */
var test = function (name) {
    console.log(name);
};

test("test");
{code}

You can see, that I declared the name parameter, inside my JSDoc param as typ Number. When I call my function, I give an argument as a string. In IntelliJ, there is a feature, where the IDE check the type of the param and the returning value and so on, via the JSDoc annotations.

You can find the information here: http://blog.jetbrains.com/webide/2012/10/validating-javascript-code-with-jsdoc-types-annotations/

This feature would be very nice, so we can have a semi type checker for JavaScript, without learning TypeScript or Flow or AtScript or whatever.


Regards

Chris

  was:
I have this piece of code:

/**
 * @param {Number} name description
 */
var test = function (name) {
    console.log(name);
};

test("test");

You can see, that I declared the name parameter, inside my JSDoc param as typ Number. When I call my function, I give an argument as a string. In IntelliJ, there is a feature, where the IDE check the type of the param and the returning value and so on, via the JSDoc annotations.

You can find the information here: http://blog.jetbrains.com/webide/2012/10/validating-javascript-code-with-jsdoc-types-annotations/

This feature would be very nice, so we can have a semi type checker for JavaScript, without learning TypeScript or Flow or AtScript or whatever.


Regards

Chris


> Please add feature to check types via JSDoc
> -------------------------------------------
>
>                 Key: NETBEANS-184
>                 URL: https://issues.apache.org/jira/browse/NETBEANS-184
>             Project: NetBeans
>          Issue Type: Improvement
>          Components: javascript - Editor
>    Affects Versions: Next
>            Reporter: Christian Lenz
>
> I have this piece of code:
> {code}
> /**
>  * @param {Number} name description
>  */
> var test = function (name) {
>     console.log(name);
> };
> test("test");
> {code}
> You can see, that I declared the name parameter, inside my JSDoc param as typ Number. When I call my function, I give an argument as a string. In IntelliJ, there is a feature, where the IDE check the type of the param and the returning value and so on, via the JSDoc annotations.
> You can find the information here: http://blog.jetbrains.com/webide/2012/10/validating-javascript-code-with-jsdoc-types-annotations/
> This feature would be very nice, so we can have a semi type checker for JavaScript, without learning TypeScript or Flow or AtScript or whatever.
> Regards
> Chris



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)