How to migrate from JavaScript to TypeScript #7264
-
If I start a Pulumi project as JavaScript, how can I switch to TypeScript without re-creating my resources. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
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
Once you complete this, your next Helper script for steps 1 and 2The below shell commands will help with steps 1 and 2 above using jq:
|
Beta Was this translation helpful? Give feedback.
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
package.json
for TypeScript:main: "index.js"
(or similar) definition.@types/node
to yourdevDependencies
- e.g.npm i @types/[email protected] --save-dev
.tsconfig.json
) to your project.*.js
files to*.ts
and make any necessaryimport
/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…