Skip to content

assertTypeString

Assert that a value is of type string, with type-narrowing.

import { assertTypeString } from "@kensio/smartass";
const value: unknown = "Ada";
assertTypeString(value);
// value is now narrowed to string

Source file: src/assert/type-string/type-string.assert.ts