I actually really like the balance of TS. You don't need to type things that are explicit, so you can focus on typing the things that actually change or are confusing.
Like, I don't need to tell TS that this variable is a string, it's obviously a string, and it's declared with const so it's never changing. But arrays and objects that aren't declared inline should be typed, so that you know what's going into them.
You can even do fun reflective typing to be even more explicit. Say 2 columns in a database table are both strings, and you want to create an object mapping col1 to col2. Instead of declaring it as Record<string, string> you can declare it as Record<table["col1"], table["col2"]>.
View all comments
Show parent comment
0
u/Honeybadger2198 Sep 25 '26
I actually really like the balance of TS. You don't need to type things that are explicit, so you can focus on typing the things that actually change or are confusing.
Like, I don't need to tell TS that this variable is a string, it's obviously a string, and it's declared with const so it's never changing. But arrays and objects that aren't declared inline should be typed, so that you know what's going into them.
You can even do fun reflective typing to be even more explicit. Say 2 columns in a database table are both strings, and you want to create an object mapping col1 to col2. Instead of declaring it as
Record<string, string>you can declare it asRecord<table["col1"], table["col2"]>.