Until now, [JavaScript](https://docs.netlify.com/functions/build-with-javascript/) and [Go](https://docs.netlify.com/functions/build-with-go/) were the two languages natively supported by [Netlify Functions](https://www.netlify.com/blog/2021/02/18/netlify-functions-for-an-unrivaled-serverless-workflow/). You could technically author functions with TypeScript, but you needed a build step that compiled your code down to plain JavaScript prior to deploying.

Well, not anymore! We’re happy to introduce native TypeScript support in Netlify Functions.

At Netlify, we want you to enjoy the same powerful workflows and abilities when building with serverless functions as you do when building the rest of your application. Native TypeScript support for Netlify Functions is the latest step in our quest to build simpler development workflows.

## Preparing your project

Before creating a TypeScript function, you should add the `@netlify/functions` module to your project.

```
npm install @netlify/functions
```

This module won’t add any files to the functions, so you don’t need to worry about it contributing to the weight of your dependencies. We’ll use it simply to import the TypeScript typings.

## Creating a function

With the initial setup taken care of, you can create a function by placing a file with the `.ts` extension in your functions directory.

```
import { Handler } from '@netlify/functions'
const handler: Handler = async (event, context) => {  return {    statusCode: 200,    body: JSON.stringify({ message: "Hello World" })  }}
export { handler }
```

When you use the `Handler` type on a function, the arguments (`event` and `context`) and the response will be typed accordingly. Alternatively, you can import the types `HandlerEvent`, `HandlerContext` and `HandlerResponse` separately and use them to construct a handler function.

We’ll automatically load any `tsconfig.json` configuration files found in your functions directory or the project’s root directory.

## Local development

You can use [Netlify Dev](https://www.netlify.com/products/cli/) to develop your TypeScript functions locally, with no additional tooling or configuration needed.

To get started, install the Netlify CLI or upgrade to version `3.19.0` or above if you’ve already installed it.

```
# Install or update the Netlify CLInpm install netlify-cli -g
# Start Netlify Devnetlify dev
```

Every time you create or update a TypeScript function, we’ll automatically compile it and make it available on your local development server.

## Implementation notes

Our build system uses [esbuild](https://www.netlify.com/blog/2021/04/02/modern-faster-netlify-functions/) to compile TypeScript functions, which introduces some implementation details you should keep in mind.

First of all, we don’t perform any type checking on your files. This can be handled by most modern code editors, as they can check types and offer visual feedback in real time. Alternatively, you can install the official TypeScript compiler and run `tsc --noEmit` locally, using it solely for type checking.

![""](/v3/img/blog/type-checking.png)

Secondly, we recommend that you enable the [`esModuleInterop`](https://www.typescriptlang.org/tsconfig#esModuleInterop) and [`isolatedModules`](https://www.typescriptlang.org/tsconfig#isolatedModules) properties in your TypeScript configuration file, for better compatibility.

Finally, if you have JavaScript and TypeScript functions with the same name (e.g. `my-function.js` and `my-function.ts`), the JavaScript function takes precedence. This gives you the option to handle the TypeScript compilation yourself if you want to, while ensuring that any existing functions using this setup will continue to behave in exactly the same way.

Whether you’re writing your serverless functions in TypeScript, JavaScript, or Go, you can find more information on ways to make the most of them on Netlify [in our docs](https://docs.netlify.com/functions/overview/).

### Share

-   [X (fka Twitter)](https://twitter.com/intent/tweet?text=Announcing Native TypeScript Support for Netlify Functions&url=https://www.netlify.com/blog/2021/04/19/announcing-native-typescript-support-for-netlify-functions//)
-   [LinkedIn](https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fwww.netlify.com%2Fblog%2F2021%2F04%2F19%2Fannouncing-native-typescript-support-for-netlify-functions%2F%2F)
-   [Facebook](https://www.facebook.com/sharer.php?u=https://www.netlify.com/blog/2021/04/19/announcing-native-typescript-support-for-netlify-functions//)
-   [Bluesky](https://bsky.app/intent/compose?text=Announcing Native TypeScript Support for Netlify Functions+https://www.netlify.com/blog/2021/04/19/announcing-native-typescript-support-for-netlify-functions//)

* * *

### Tags

-   [Functions](/blog/tags/functions/)
-   [TypeScript](/blog/tags/typeScript/)

## Keep reading

![](/images/blog-fallback-thumbnail.svg)

Tools & Services February 18, 2021

[

### Netlify Functions - for an unrivaled serverless workflow

](/blog/2021/02/18/netlify-functions-for-an-unrivaled-serverless-workflow/)

-   ![Profile picture of Phil Hawksworth](/_astro/9cfe2bbe94bcb555ce3ac7683ac7905ad3fd32b1-400x400_Z18H6R1.webp)
    
    Phil Hawksworth
    

![](/images/blog-fallback-thumbnail.svg)

News & Announcements October 29, 2020

[

### Announcing Background Functions

](/blog/2020/10/29/announcing-background-functions/)

-   ![Profile picture of Jessica Parsons](/_astro/e3f8d44362abcfc31621da872bf201a53be9f66d-512x512_1eYHs2.webp)
    
    Jessica Parsons
    

## Recent posts

News & Announcements June 25, 2026

[

### Netlify Functions, designed for Agent Experience

](/blog/netlify-functions-designed-for-agent-experience)

-   ![Profile picture of Eduardo Bouças](/_astro/52958f21e8450baf6d8e60302341a984e220c0cd-512x512_13VDlu.webp)
    
    Eduardo Bouças
    

News & Announcements June 24, 2026

[

### How we measure Netlify’s Agent Experience

](/blog/how-we-measure-netlify-agent-experience)

-   ![Profile picture of Sean Roberts](/_astro/bbf2243f8171dbddd80ab2103622106cef84d125-512x512_Z1d2LKE.webp)
    
    Sean Roberts
    

Guides & Tutorials May 15, 2026

[

### How to build a real-time AI chatbot in minutes with Netlify Agent Runners (no backend)

](/blog/how-to-build-a-real-time-ai-chatbot-in-minutes-with-netlify-agent-runners-no-backend)

-   ![Profile picture of Nahrin Jalal](/_astro/f0e7c8f227a03fe58340c99ef5439d5a896c0733-272x272_Z23kDpD.webp)
    
    Nahrin Jalal
    

![](/_astro/3f255b372fa958df35802666ee33b4609b2d71bd-1200x1586_1VtE2D.webp)

### How do the best dev and marketing teams work together?

[Access the report](https://www.netlify.com/reports/2024-leadership-trend-report/access/)