Type System
DTL has a strong type system that helps catch errors early. Types can be explicitly declared or automatically inferred from values.
Type Inference
DTL automatically infers types from values, so you rarely need to specify them explicitly:
Explicit Types
You can also explicitly declare types using a colon (:):
Available Types
Color
Represents color values in various formats:
Size
Represents dimensional values with units:
Number
Represents numeric values without units:
Font & FontFamily
Represents font names and font stacks:
FontWeight
Represents font weight values:
Duration
Represents time durations:
String
Represents text values:
Array Types
Arrays can hold multiple values of the same type:
Type Checking
DTL performs type checking to ensure type safety. Type mismatches will result in compilation errors:
Type Coercion
Some types can be automatically coerced in certain contexts. For example, numbers can be used where sizes are expected: