0

I want to do jsdoc with something like the following

/**
@param {string|number[]}
*/

In the above it's an array of numbers or a string, but I want an array of numbers and/or strings. I need this to work for other things like 2 different kinds of objects. Does anyone know how to do this?

Spam
  • 1
  • 2
  • I believe this is what you are looking for: [How to specify an array of objects as a parameter or return value in JSDoc?](https://stackoverflow.com/questions/14611995/how-to-specify-an-array-of-objects-as-a-parameter-or-return-value-in-jsdoc) – Slava Ivanov Dec 11 '18 at 15:53

1 Answers1

1

If you are using Closure Compiler, you can write: /** @param {!Array<number|string>} x */ function f(x) {}

See this example.

dimvar
  • 561
  • 5
  • 14