Data types
LIGO is strongly and statically typed.
This means that the LIGO compiler must know what type each variable is to compile to Michelson, which is also strongly and statically typed. The compiler also uses type information to check how contracts process data, ensuring that each function's expectations are met. If it passes the test, your contract will not fail at run-time due to some inconsistent assumptions on your data. This test is called type checking.
LIGO types are built on top of Michelson's type system, so there are many similarities but not a one-to-one match between LIGO types and Michelson types. For information on Michelson types, see Michelson: the language of Smart Contracts in Tezos in the Octez documentation.
Types and type annotations work in a way similar to TypeScript and OCaml; see Type annotations.
Built-in types
For reference, you can find all the LIGO built-in types here.
Type aliases
You can create aliases for types to give them more precise names, which can increase readability and maintainability of your code.
The following example creates an alias of the string type named breed to indicate variables that describe animal breeds.
Then it creates a function that accepts variables of that type:
Type aliases are not separate types. Types and their aliases are interchangeable. As shown in the previous example, you can pass any string to a function that accepts an alias of a string type.
Custom types
You can create custom types with the type keyword.
Then you can use those types in other places, as in this example, which creates a type to represent a map that uses addresses as keys and amounts of tez as values: