Skip to content

toString

The toString() function converts a literal (number, string, bigint, boolean, null, undefined) into a typed template string.

Interactive example

Syntax

typescript
function toString<
	GenericInput extends number | string | bigint | boolean | null | undefined
>(
	input: GenericInput
): `${GenericInput}`;

Parameters

  • input : Literal to convert into a typed string.

Return value

A typed literal string corresponding exactly to the provided value.

See also

Released under the MIT license.