Elixir Static Typing

Discussions center on Elixir's dynamic typing limitations, the role of Dialyzer and typespecs for static analysis, and ongoing developments toward gradual and static typing features.

📉 Falling 0.5x Programming Languages
1,122
Comments
19
Years Active
5
Top Authors
#3381
Topic ID

Activity Over Time

2008
1
2009
2
2010
2
2011
10
2012
2
2013
11
2014
14
2015
34
2016
60
2017
72
2018
81
2019
71
2020
147
2021
60
2022
87
2023
207
2024
121
2025
130
2026
10

Keywords

erlang.org typescriptlang.org BEAM OTP foo.bar lang.org hexdocs.pm VS TypeScript IIUC elixir typing static static typing erlang type typed beam gradually typescript

Sample Comments

karmajunkie Jan 26, 2023 View on HN

There's a component called dialyzer that can help detect type issues, but i wouldn't say its nearly as useful as having real types in a language. That said, I've never found it to be much of an issue in Elixir, and the advantages you get with BEAM are worth it. There's a newer language called Gleam that does have a strong type system you may want to investigate, as it runs on BEAM (like Elixir and Erlang) and can use libraries and applications from both in its apps.

harrisi Jul 23, 2025 View on HN

I believe you meant static typing. There's active ongoing work in this space, and Elixir is actually gradually typed now. You can read more about it in the docs: https://hexdocs.pm/elixir/gradual-set-theoretic-types.html

ianleeclark Aug 5, 2024 View on HN

Elixir has had dialyzer + type hints for years

arrowsmith Nov 8, 2023 View on HN

FYI: Elixir may be getting static typing in a future version.https://elixir-lang.org/blog/2023/09/20/strong-arrows-gradua...

ninjakeyboard Jun 22, 2018 View on HN

awesome - thanks for the reply. Makes sense. I work with elixir full time and the type-safety bugs me. I'll check this out when I can find some time.

ashton314 Jan 27, 2020 View on HN

Have you looked at Dialyxir? [1] It makes Elixir feel like a structurally typed language. I use it at work, and it catches a lot of inconsistencies at runtime.[1]: https://github.com/jeremyjh/dialyxir

skrebbel Apr 17, 2020 View on HN

Same. I suffer through it, because the rest is pretty neat.There is no best way. Fortunately the Elixir core libraries are annotated with typespecs, which gets you like 30% there. But dialyzer sucks, and the typespec syntax itself, as well as its expressiveness, leave a lot to be desired. It's clearly an afterthought.One day I'm gonna make a TypeScript for Elixir.Note: There's eg Gleam a statically typed language for BEAM, but it's quite unlike Elixir and it has a mu

yawaramin Jan 6, 2019 View on HN

I agree and believe that it's harder to maintain a dynamically-typed codebase, but Elixir has a well-thought-out gradual typing solution: typespecs ( https://hexdocs.pm/elixir/typespecs.html#basic-types ). This builds on Erlang's Dialyzer tool and is supported by editor plugins like VSCode's ElixirLS extension. In practice, you do get instant typechecking while

tigershark Nov 7, 2017 View on HN

Although I really like elixir, I thought he asked for something with static typing?

benzible Sep 15, 2025 View on HN

Elixir is gradually typed: https://news.ycombinator.com/item?id=38914407...and is gradually getting more gradually typed: https://elixirforum.com/t/elixir-v1-19-0-rc-0-released/71190...