Grokking TypeScript
Vote

0% completed

​

Avoid Common Pitfalls and Anti-patterns

A TypeScript file can compile with no errors and still crash on its first run. In most such cases, the code has told the compiler to stop checking something, or a value has come from outside the program. The seven pitfalls below all appear in one small example, a shop that displays products, loads them from a server and calculates shipping costs.

Overusing any

The type any turns off checking for a value. Every operation on it compiles, so the compiler cannot warn you about any of them.

function formatLabel(value: any) { return value.toUpperCase(); } console

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content