to
The to() function converts a primitive value to its string representation.
Interactive example
Syntax
Classic signature
typescript
function to<
GenericValue extends string | boolean | null | number | undefined | bigint
>(
value: GenericValue
): `${GenericValue}`Parameters
value: The primitive value to convert.
Return value
A string representation of the input value, preserving literal types when possible.
See also
concat- Concatenates multiple stringstoLowerCase- Converts a string to lowercase
