Sometimes, we want to import all types with TypeScript or JavaScript.
In this article, we’ll look at how to import all types with TypeScript or JavaScript.
How to import all types with TypeScript or JavaScript?
To import all types with TypeScript or JavaScript, we can use *.
For instance, we write
import * as foo from "./otherClass";
to import all the exported contents as the foo object from the otherClass module.
Then we can use the imports by writing
foo.ClassA
to use ClassA from the otherClass module.
Conclusion
To import all types with TypeScript or JavaScript, we can use *.