Type Inference

preview_player
Показать описание
In @typescript are you explicit or implicit with your types?

Join us for our chat with @JoshuaKGoldberg for more

Рекомендации по теме
Комментарии
Автор

Been programming for multiple decades now, across a variety of languages and platforms, and I always specify types when declaring variables and function return values - I _never_ rely on type inference because there's no guarantee of consistency even across differing versions of the same compiler/language/platform. The last thing you'll need is for weird bugs to pop up because the compiler chose a type that doesn't cast or convert cleanly later on down the line, e.g., mixing string types that are of dissenting base types like a C/C++ style null-terminated string versus a char/byte array versus a quoted literal. Forced consistency removes ambiguity.

OddlyIncredible