JSFiddle - React, Tailwind, and code Playground

by Paul Wheeler

TypeScript

type Test = string | boolean | string[] | boolean[];

const test = (param: Test) => Array.isArray(param) ? param : [param];

console.log(test('foo'));