Basic Types @param {string} name → A string parameter @param {number} age → A number parameter @param {boolean} isActive → A boolean parameter @param {void} → No return value Array & Object Types @param {Array} items → A generic array @param {string[]} names → An array of strings @param {number[]} scores → An array of numbers @param {Object} user → A generic object @param {{ id: number, name: string }} user → An object with specific properties Function & Callback Types @param {Function} callback → A function parameter @param {(num: number) => void} callback → A function taking a number and returning nothing Return Types @returns {string} → Returns a string @returns {number} → Returns a number @returns {void} → Returns nothing @returns {Promise<string>} → Returns a Promise resolving to a string Other Useful Types @param {any} value → Accepts any type @param {null} data → A parameter that can be null @param {undefined} value → A parameter that can be undefined HTML Element Types @param {HTMLElement} element → Any HTML element @param {HTMLDivElement} div → A <div> element @param {HTMLButtonElement} button → A <button> element @param {HTMLInputElement} input → An <input> element @param {HTMLFormElement} form → A <form> element
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter