Sometimes, we want to import all types with TypeScript.
In this article, we’ll look at how to import all types with TypeScript.
How to import all types with TypeScript?
To import all types with TypeScript, we can do a namespace import.
For instance, we write
import * as foo from "./otherClass";
to import all members of the ./otherClass
module as foo
.
Then we can access any member of it from foo
like
foo.bar
where bar
is an exported member from ./otherClass
.
Conclusion
To import all types with TypeScript, we can do a namespace import.