Type Annotations Debate

Discussions center on the value of type annotations in programming, particularly their role as reliable documentation, benefits for code readability in large dynamically-typed codebases, and comparisons to comments or inferred types.

➡️ Stable 0.6x Programming Languages
3,727
Comments
19
Years Active
5
Top Authors
#2599
Topic ID

Activity Over Time

2008
1
2009
28
2010
21
2011
35
2012
69
2013
105
2014
161
2015
135
2016
224
2017
200
2018
235
2019
323
2020
418
2021
338
2022
376
2023
369
2024
271
2025
411
2026
7

Keywords

e.g PHP TypeScript SelectObject IDE OPTIONALLY E2E types type annotations typing code documentation functions variable complicated typed

Sample Comments

sebazzz Jan 8, 2019 View on HN

Types are documentation, very useful in large dynamically- typed code bases.

dons Mar 17, 2011 View on HN

Without types, how do you know you're not writing nonsense?

You can't really on type annotations to help interpret the code.

Aldo_MX Jan 12, 2022 View on HN

Comments have the potential to get forgotten and become incorrect. Type annotations not.

z3t4 May 14, 2023 View on HN

Type decorations without the performace benefit feels stupid. Types can be inferred for static analysis tools.

noobiemcfoob Dec 12, 2018 View on HN

I can't answer what you're missing as I'm missing it too. Type annotations have seemed to me as useful documentation. If they're strictly enforced, it might make it easier for a new coder to interface with unfamiliar code...but if it was designed well in the first place, duck typing should handle it and raise exceptions as appropriate.

IshKebab Apr 29, 2025 View on HN

Do you... have type annotations? I think you might be missing the point.

lugged Oct 12, 2021 View on HN

What's the point of typing things if you have to constantly typecheck them anyway?

AlphaSite Oct 10, 2025 View on HN

Types don’t explain intent or gotchas. They’re also useful, but you need both.

DrFalkyn Feb 14, 2025 View on HN

Type annotations by themselves, are little more than a comment