How to export a function with TypeScript?

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.