Need Assistance?

support@tutorialshub.in

Getting Started with TypeScript

Type Inference vs Explicit Annotations

ADVERTISEMENT
TypeScript Free Lesson
5 min read
ADVERTISEMENT

You don't have to write : string or : number on every single line! TypeScript is smart—when you write let score = 100;, it automatically infers that score is a number.

Best Practice: Let TypeScript infer local variables, and write explicit type annotations for function parameters, return types, and empty arrays.

ADVERTISEMENT
Hi, I'm Tuby! Here to help you