Categories
TypeScript Answers

How to reexport a class in TypeScript?

Spread the love

Sometimes, we want to reexport a class in TypeScript.

In this article, we’ll look at how to reexport a class in TypeScript.

How to reexport a class in TypeScript?

To reexport a class in TypeScript, we can use the export keyword.

To export a class that’s a member of another module, we write

export { A } from "a";

where A is the class that we want to export from module a.

To export a class that’s a default export, we write

export { default } from "d";

to export default instead of the class name.

Conclusion

To reexport a class in TypeScript, we can use the export keyword.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *