Skip to content

isStringArray

Jason Godesky edited this page Jul 11, 2026 · 1 revision

isStringArray is a type guard that lets Typescript know that the variable passed in is an array of strings (string[]).

Note

This is just a wrapper for makeArrayGuard with isString.

Parameters

candidate: unknown

Supply any variable to test if it’s an array of strings (string[]) or not.

Returns

A type predicate for an array of strings (candidate is string[]).

Examples

import { isStringArray } from '@revolutionarygamesco/common'

isStringArray(['hello!']) // true
isStringArray([]) // true
isStringArray('hello!') // false
isStringArray(['hello!', 42]) // false
isStringArray({ a: 'hello!' }) // false
isStringArray(42) // false

Clone this wiki locally