Categories
JavaScript Answers

How to export a function with TypeScript?

Spread the love

Sometimes, we want to export a function with TypeScript.

In this article, we’ll look at how to export a function with TypeScript.

How to export a function with TypeScript?

To export a function with TypeScript, we use the export keyword.

For instance, we write

const someFunc = () => {};

export { someFunc as someFuncName };

to export the someFunc function with name someFuncName.

Conclusion

To export a function with TypeScript, we 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 *