Skip to content

How to migrate from JavaScript to TypeScript #7264

Discussion options

You must be logged in to vote

A Pulumi project can be converted from JavaScript to TypeScript with the steps below. This allows you to migrate without having to re-create stacks or resources.

Steps

  1. Update your package.json for TypeScript:
    1. Remove the main: "index.js" (or similar) definition.
    2. Add @types/node to your devDependencies - e.g. npm i @types/[email protected] --save-dev.
  2. Add a TSConfig file (tsconfig.json) to your project.
  3. Rename your *.js files to *.ts and make any necessary import/require changes.

Once you complete this, your next pulumi pre will execute as TypeScript rather than JavaScript. You should not see any actual resources changes with the exception of using Pulumi's inline serverless function support…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by emiliza
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/question Questions about existing features resolution/fixed This issue was fixed
1 participant
Converted from issue

This discussion was converted from issue #6879 on June 09, 2021 23:11.