https://pulumi.com logo
#typescript
Title
# typescript
e

elegant-pager-5412

04/22/2021, 5:11 AM
Hey Guys! If I’m using TypeScript with Pulumi, what is the latest 
target
 I can use? Currently the default seems to be 
es2016
. Is there any reason why won’t I bump it to 
es2020
? Also, as for the 
module
 definition, can I use 
ES2020
 or 
ESNext
?
l

little-cartoon-10569

04/22/2021, 5:13 AM
Check out the notes at the bottom of this page: https://www.pulumi.com/docs/intro/languages/javascript/
Essentially, you can configure anything you like for module and target; your IDE will use those.
Pulumi will use target es6 and module commonjs, unless you turn off Typescript support.
e

elegant-pager-5412

04/22/2021, 5:14 AM
Hey!
l

little-cartoon-10569

04/22/2021, 5:14 AM
You should lose no functionality if you turn off the built-in Typescript support, you just have to manage all the options yourself.
e

elegant-pager-5412

04/22/2021, 5:15 AM
What is the best practice?
The app was generated with
es2016
and not
es6
l

little-cartoon-10569

04/22/2021, 5:15 AM
If you're confident in your tsconfig / register=ts-node magic, then manage it yourself, you'll get your own preferred environment.
Ah, maybe they've update that to es2016 but forgot to update the docs.
e

elegant-pager-5412

04/22/2021, 5:17 AM
And how do I pipe it to pulumi?
l

little-cartoon-10569

04/22/2021, 5:17 AM
There is no best practice, I think. It's a bit like deciding between using the aws and awsx packages when buliding your VPC. Both are good, you just pick which is right for you.
e

elegant-pager-5412

04/22/2021, 5:17 AM
I guess I would need to compile it on my own and pipe the results to pulumi
b

billowy-army-68599

04/22/2021, 5:18 AM
generally you'd run your typescript program with the pulumi CLI, unless you're using the Pulumi CLI
e

elegant-pager-5412

04/22/2021, 5:20 AM
I’m slightly confused. If I want the lambdas to contain the most minimal possible code, I would like it to use native JS code instead of transpiling it
how can I use custom
tsconfig
options while piping the output to pulumi cli?
b

billowy-army-68599

04/22/2021, 5:32 AM
would be good to get a little context on what your desired goal is
e

elegant-pager-5412

04/22/2021, 5:40 AM
@billowy-army-68599 Right now it seems like the built-in typescript support is for
commonjs
modules and
es2016
which is good but it transpiles the code into a less readable code. I would like to know if it’s possible to transpile the code into a “modern” JS syntax
4 Views