TypeScript · Middle · Question 18 of 75

How do namespaces (namespace) differ from ES modules?

Explanation

Namespaces predate ES modules and create objects at runtime. Code is now organized into files with import/export, while declare namespace is sometimes used in declarations to describe global libraries. Namespaces aren't compatible with erasableSyntaxOnly.

Further reading

Problem with a question

TypeScript · Middle · question 18

Test yourself

Take the TypeScript · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz