Type aliasing
In-game article clicks load inline without leaving the challenge.
Type aliasing is a feature in some programming languages that allows creating a reference to a type using another name. It does not create a new type hence does not increase type safety. It can be used to shorten a long name. Languages allowing type aliasing include: C++, C# Crystal, D, Dart, Elixir, Elm, F#, Go, Hack, Haskell, Julia, Kotlin, Nim, OCaml, Python, Rust, Scala, Swift and TypeScript.
Example
C++
C++ features type aliasing with the using keyword.
C#
C# version 12 and higher supports type aliasing with the using keyword. Earlier versions restrict its use to file-local scope or specific import contexts..
Crystal
Crystal features type aliasing using the alias keyword.
D
D features type aliasing using the alias keyword.
Dart
Dart features type aliasing using the typedef keyword.
Elixir
Elixir features type aliasing using @type.
Elm
Elm features type aliasing using type alias.
F#
F3 features type aliasing using the type keyword.
Go
Go features type aliasing using the type keyword and =.
Hack
Hack features type aliasing using the newtype keyword. Functionally, this creates a new, distinct type that is incompatible with its underlying type (int). This is stricter than a simple alias, which is generally transparent and interchangeable with the original type.
Haskell
Haskell features type aliasing using the type keyword.
Julia
Julia features type aliasing. The use of const is best practice (though not strictly required for aliasing). It prevents the alias from being rebound to a different type later in the program, ensuring the alias is stable.
Kotlin
Kotlin features type aliasing using the typealias keyword.
Nim
Nim features type aliasing.
OCaml
OCaml features type aliasing.
Python
Python features type aliasing.
Type aliases may be marked with TypeAlias to make it explicit that the statement is a type alias declaration, not a normal variable assignment. The use of : TypeAlias (from PEP 613) is not required for the alias to function, but it explicitly tells static type checkers (like Mypy) that the assignment is a type declaration, not a runtime variable assignment.
Rust
Rust features type aliasing using the type keyword.
Scala
Scala can create type aliases using opaque types.
Swift
Swift features type aliasing using the typealias keyword.
TypeScript
TypeScript features type aliasing using the type keyword.
Zig
Zig features type aliasing by assigning a data type to a constant.