Why parameters of my function are appears as boolean values (with JSDocs) whereas is not the case?

43 Views Asked by At

I document my reproduction of tic-tac-toe tutorial of React and I don't understand why parameters of my function are displayed as boolean values (with JSDocs) whereas it is not the case.

This is what appears when I hover the function with cursor : View with IntellijSense of the function

Here is the code of my function :

/**Return the game board.
 * 
 * @param {boolean} xIsNext Allows to show a text that tell which player is the next.
 * @param {string[]} squares The current board which will be update at the next action.
 * @param {*} onPlay A function that allows to re-render the board.
 * @returns the JSX structure of the board.
 */
function Board({xIsNext, squares, onPlay}) {
  // ...
}

Is it the fact that it's in curly braces ? Or it is the presence of React ? Or an another reason ?

1

There are 1 best solutions below

1
Liap On

Cause the Board component takes a single-props argument. Not multi param

It would be best if you defined a type for BoardProps like this

/**
 * The board properties.
 * 
 * @typedef {object} BoardProps
 * @property {boolean} xIsNext Allows to show a text that tell which player is the next.
 * @property {string[]} squares The current board which will be update at the next action.
 * @property {*} onPlay A function that allows to re-render the board.
 * /

/**
 * Board component
 * 
 * @param {BoardProps} props The board props
 * @returns {React.ReactElement}
 */
function Board({ xIsNext, squares, onPlay }) {
  // ...
}