Improving the TypeScript support in Azure Functions
With this set of changes to the Azure Functions Core Tools and the Azure Functions Extension for Visual Studio Code, Azure Functions now supports TypeScript out of the box! Included with these changes are a set of templates for TypeScript, type definitions, and npm scripts. Read on to learn more details about the new experience.
Templates for TypeScript
The best part of this new flow is that to transpile and run TypeScript functions, you don’t have to take any actions at all that are unique to Functions. For example, what this means is that when a user hits F5 to start debugging Visual Studio Code, Code will automatically run the required installation tasks, transpile the TypeScript code, and start the Azure Functions host. This local development experience is best in class, and is exactly how a user would start debugging any other app in VS Code.
Learn more about how to get your TypeScript functions up and running in our documentation.
Type definitions for Azure Functions
Included by default in the TypeScript function apps is a package.json file including a few simple npm scripts. These scripts allow Azure Functions to fit directly into your typical development flow by calling specific Azure Functions Core Tools commands. For instance, ‘npm start’ will automatically run ‘func start’, meaning that after creating a function app you don’t have to treat it differently than any other Node.js project.
To see these in action, check out our example repo!
Try it yourself!
With either the Azure Functions Core Tools or the Azure Functions Extension for VS Code, you can try out the improved experience for TypeScript in Azure Functions on your local machine, even if you don’t have an Azure account.
- Get started with Azure Functions in VS Code.
- Get started with Azure Functions in your CLI with the Azure Functions Core Tools.
- Check out a sample TypeScript Function App.
- Sign up for an Azure free account if you don’t have one, and deploy your serverless apps to the cloud.
As always, feel free to reach out to the team with any feedback on our GitHub or Twitter. Happy coding!
Source: Azure Blog Feed