Hacker News new | past | comments | ask | show | jobs | submit login

Why null as any[]? Can’t it just be []?



Actually, if you do that you get:

"Property 'email' does not exist on type 'never'.ts(2339)"

When you do

{{customer.email}}


Use `[] as TheRealType`. `any` is the real wart on the language, not unknown, which adds safety by preventing you from doing anything dangerous with it.




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: