Knowledgebase

TypeScript as a Language Print

  • programminglanguages, programming, guide, howto, solution, zillionkinghost, hosting, support
  • 0

Types for JavaScript.

WHAT IT IS

JavaScript with a static type system, compiled to plain JavaScript.

WHAT THAT MEANS

Nothing executes it directly. It is checked, then the types are removed.

WHAT IT PROVIDES

Errors caught before running Documentation of what functions expect Substantially better tooling Confidence when refactoring

WHAT IT DOES NOT PROVIDE

Any runtime guarantee.

WHY

Types are erased. Data arriving at runtime is unchecked.

WHAT THAT MEANS

External data must be validated regardless of its declared type.

WHAT ITS TYPE SYSTEM IS NOTABLE FOR

Expressiveness: unions, generics, conditional and mapped types.

WHAT THAT ENABLES

Describing shapes that dynamic code actually produces.

WHAT IT COSTS

A build step Some verbosity A learning curve for advanced features

WHEN IT IS WORTH ADOPTING

Any project with more than one developer, or maintained over time.

WHAT TO CONFIGURE

Strict checking, without which many benefits are absent.

WHAT TO AVOID

The type meaning anything, which disables checking entirely.


Was this answer helpful?
Back

Are you happy with your experience? Leave us a review on Trustpilot.


Trustpilot