# Getting TypeScript to work with Netlify Functions

**URL:** <https://answers.netlify.com/t/getting-typescript-to-work-with-netlify-functions/6198>\
**Category:** Support\
**Tags:** netlify-dev-open-beta, lambda-functions, building\
**Created:** [December 13, 2019, 2:57am UTC](https://answers.netlify.com/t/getting-typescript-to-work-with-netlify-functions/6198 "2019-12-13T02:57:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![PabloRoman](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/pabloroman/32/4853_2.png) [@PabloRoman](https://answers.netlify.com/u/PabloRoman)\
**Post date:** [December 13, 2019, 2:57am UTC](https://answers.netlify.com/t/getting-typescript-to-work-with-netlify-functions/6198/1 "2019-12-13T02:57:05Z")

</div>

Both netlify-lambda build and netlify-lambda serve don’t seem to be verifying the types of TypeScript code. I tried it with the example project sw-yx/create-react-app-lambda-typescript, and something as simple as `let a: number = 'abc'` doesn’t trigger any warnings. How can I add type checking?

Marcus Weiner suggested that I use netlify dev and define a task that runs typescript with the watch flag `-w` so it will run on every code change, but I don’t know where to put it so it will run with netlify dev.

---

<div class="post-metadata">

**Author:** ![Dennis](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/dennis/32/34_2.png) [@Dennis](https://answers.netlify.com/u/Dennis)\
**Post date:** [December 17, 2019, 2:03pm UTC](https://answers.netlify.com/t/getting-typescript-to-work-with-netlify-functions/6198/2 "2019-12-17T14:03:08Z")

</div>

You’ll want to run that task as part of your build command. You can add the build command to your netlify.toml file or [explicitly set it as mentioned in our cli docs](https://cli.netlify.com/commands/dev#devexec). Hope that helps.

---

<div class="post-metadata">

**Author:** ![PabloRoman](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/pabloroman/32/4853_2.png) [@PabloRoman](https://answers.netlify.com/u/PabloRoman)\
**Post date:** [December 18, 2019, 2:43am UTC](https://answers.netlify.com/t/getting-typescript-to-work-with-netlify-functions/6198/3 "2019-12-18T02:43:57Z")

</div>

Thanks for the help, but I still don’t know how to add the tsc command to get TypeScript to check the types and keep listening for changes when developing.

---

<div class="post-metadata">

**Author:** ![Dennis](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/dennis/32/34_2.png) [@Dennis](https://answers.netlify.com/u/Dennis)\
**Post date:** [December 19, 2019, 2:14pm UTC](https://answers.netlify.com/t/getting-typescript-to-work-with-netlify-functions/6198/4 "2019-12-19T14:14:38Z")

</div>

That’ll be up to you how you add tsc to your build pipeline.

---

<div class="post-metadata">

**Author:** ![pushkar8723](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/pushkar8723/32/10503_2.png) [@pushkar8723](https://answers.netlify.com/u/pushkar8723)\
**Post date:** [May 9, 2020, 5:41pm UTC](https://answers.netlify.com/t/getting-typescript-to-work-with-netlify-functions/6198/5 "2020-05-09T17:41:13Z")

</div>

> **[GitHub - pushkar8723/apollo-graphql-typescript: Template for serverless Apollo...](https://github.com/pushkar8723/apollo-graphql-typescript)**
>
> Template for serverless Apollo + GraphQL + TypeScript app deployed on Netlify - GitHub - pushkar8723/apollo-graphql-typescript: Template for serverless Apollo + GraphQL + TypeScript app deployed on...

I created this template for Apollo GraphQL + TypeScript lambda. But it can be easily changed for other cases as well. TypeScript in this template is part of the build process itself.
