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?

1

1 Answer 1

1

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

See this example.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.