Skip to content

IntelliSense with types of JSDoc #3802

@anseki

Description

@anseki

I tried this:

/**
 * @param {string} param1 - Normal
 * @param {string|number|boolean} param2 - Multiple types
 * @param {null} param3 - (I know this is strange param.)
 * @param {string|number|null} param4 - Multiple types includes `null`
 * @param {Object} param5 - Object type
 * @param {Array} param6 - Array type
 * @param {jQuery} param7 - Another type
 * @param {MyClass} param8 - Another type
 * @param {string|number|Array} param9 - Multiple types includes `Array`
 * @param {?string} param10 - Nullable type
 * @param {string} [param11] - Optional
 * @returns {?string} result
 */
function fnc(param1, param2, param3, param4, param5, param6,
    param7, param8, param9, param10, param11) {
  return param11;
}

fnc();
  • param3: any, param4: any, param6: any, param7: any, param8: any, param9: any
  • param10: string

It seems that:

  • The type of @param that includes null, Array, and other classes other than Object are shown as any.
  • The optional params are shown with ?, but nullable params and returns are shown with nothing.

I hope that the specified types are shown even if that is null, Array, or unknown type such as jQuery or MyClass. And nullable params are shown like optional params.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions