Literal Types

You can use literals as type to specify that the only possible value is the string literal itself. For instance, the following type defines the property constant whose value must be equal to "foo".
type Foo {
constant: "foo"

Regular Expression Types

Literal types are a particular case for regular expression types, where each instance of the type matches the defining regular expression.
The following type defines the regexp property whose value must match the /foo+/ regular expression recognizing every "fo...o" string with at least two o.
type Foo {
regexp: /foo+/