TypeScript v2 allows users to take advantage of several key improvements over TypeScript v1, including a Node.js runtime and first-class OSDK support. Review the sections below to get started.
Navigate to a project of your choice and create a new code repository by selecting + New > Repository. Select the TypeScript v2 functions template to initialize your repository.

Once the repository has been created, navigate to the typescript-functions/src/functions/helloWorld.ts file.
To write a new function, create a new file in the typescript-functions/src/functions directory of your repository and give it a descriptive name, for example, helloWorld.ts. Write your function using export default for Foundry to detect it.
Copied!1 2 3export default function helloWorld(): string { return "Hello World!"; }
You must satisfy the following conditions for your function to be published to Foundry:
.ts file in the typescript-functions/src/functions directory. In this directory, you can also group related functions in subdirectories.myFunction to be published, it must be defined in a file called myFunction.ts within the typescript-functions/src/functions directory.Your function's file path is used to uniquely identify the function that gets published from it. Note that a change in your function's file path will therefore result in a new function being published.
To test your function in live preview, open the Functions helper and select Live preview. Choose your function and select Run to execute.
Select Commit at the upper right corner of the window to commit your changes to the master branch of your repository. To view your function's checks, open the Checks tab at the top of the page. Here, after making a commit, you should see a running check.
After committing your work, you will see the Tag version option. This will publish all of the functions in your repository.

Select Tag version to tag a release off of the master branch. Set the tag name based on the extent of your changes, and then select Tag and release.
To view the progress as your functions are tagged and released, select the View pop-up or navigate to the Tags tab. Once Step 2: Release is completed, select the published functions to view them in the function registry.
Functions may not be immediately searchable by name in Workshop or the function registry while permissions propagate.

After the checks for your tag have passed, navigate back to the Code tab in Code Repositories and select the Functions helper. You should now be able to see your functions under the Published section. Select it and run the new function:
