Info
This site is generated using the static site generator developed by the Typst Community. Please adjust the text content of this banner according to your usage requirements. At Typst GmbH's request, when publishing documentation, you must clearly indicate that it is non-official and display the version of Typst being documented. For details, refer to Issue #874 on typst/typst.
TypstDocumentEnglish
v0.dev.2025-09-12

version

A version with an arbitrary number of components.

The first three components have names that can be used as fields: major, minor, patch. All following components do not have names.

The list of components is semantically extended by an infinite list of zeros. This means that, for example, 0.8 is the same as 0.8.0. As a special case, the empty version (that has no components at all) is the same as 0, 0.0, 0.0.0, and so on.

The current version of the Typst compiler is available as sys.version.

You can convert a version to an array of explicitly given components using the array constructor.

Constructor
Parameter
Parameters are input values for functions. Specify them in parentheses after the function name.

Creates a new version.

It can have any number of components (even zero).

version()->
#version() \
#version(1) \
#version(1, 2, 3, 4) \
#version((1, 2, 3, 4)) \
#version((1, 2), 3)
Preview

components
Required
Required
Required parameters must be specified when calling the function.
Positional
Positional
Positional parameters can be set by specifying them in order, omitting the parameter name.
Variadic
Variadic
Variadic parameters can be specified multiple times.

The components of the version (array arguments are flattened)

Definition
Definition
These functions and types can have related definitions. To access a definition, specify the name of the function or type, followed by the definition name separated by a period.

at

Retrieves a component of a version.

The returned integer is always non-negative. Returns 0 if the version isn't specified to the necessary length.

self.at()->

index
Required
Required
Required parameters must be specified when calling the function.
Positional
Positional
Positional parameters can be set by specifying them in order, omitting the parameter name.

The index at which to retrieve the component. If negative, indexes from the back of the explicitly given components.

Open official docs

Search