Pages
Introduction
Getting Started
Recipes
Reference
Literals
Arrays
Tuples
Type System
Functions
Modules
Records
Enums
Built-in Types
Constants
Equality
Stores
Routing
Comments
Control Expressions
Components
Properties
Computed Properties
Styling Elements
Connecting Stores
Using Providers
Internal State
Referencing Entities
Global Components
Lifecycle Functions
Directives
JavaScript Interop
Environment Variables
Packages
Type System
In Mint the types and type definitions are only for the type checker and compiler, they are not available or used by the runtime.
Because of that types can be defined in any type definition (except Records and Enums),
so for example if
Time
is not defined as an
Enum
or
Record
when writing this:
module Time {
fun now : Time {
...
}
}
will define
Time
as a type.
Since only this function defines this as a return type we can safely use the same type in type signatures of other functions:
fun day (date : Time) : Number {...}
fun format (pattern : String, date : Time) : String {...}
because the
Time.now()
is the only place values of
Time
can come from.