sparse-intern-71089
09/18/2019, 9:20 PMclever-sunset-76585
09/18/2019, 10:04 PMI’m new to JS/TS but it seems to me what is needed is “top-level await” supportYes. This is tricky to do without first-class language support. Unrelated to Pulumi, but it is also one of the goals for
deno
a new framework being built by Ryan Dahl. https://github.com/denoland/deno/issues/471 has some links to relevant TS issues worth a read.worried-city-86458
09/18/2019, 10:19 PMworried-city-86458
09/18/2019, 10:20 PMwhite-balloon-205
@pulumi/pulumi
package pulls in "typescript": "^3.0.0",
, so will get the latest release of TypeScript at the time it is installed, and can be updated to any version of TypeScript that you would like to use.
For top-level-await, the bigger problem I believe is that Node would need to support it in it's core module loader. I don't believe there is any near term plan for that (the linked issue is for Node REPL support - which is not sufficient). (random aside - I drove the async/await proposal in the TC39 standards body 5 years ago, and this was a topic that was discussed at the time - most of the same issues still apply - https://github.com/tc39/ecmascript-asyncawait/issues/9 ).
Now - all that said - the Pulumi programming model in general really encourages/enables a mode where you shouldn't in general need to use await at all. The Output
type is designed to allow you to pass around data instead of having to manually write asynchrosnous control flow. I'd be interested in seeing any cases where you feel like you need top-level await in Pulumi. In general - that shouldn't be necessary.worried-city-86458
09/19/2019, 12:20 AMclever-sunset-76585
09/19/2019, 12:36 AMtall-librarian-49374
09/19/2019, 6:30 AMdoing non-Pulumi things in my Pulumi appYou can always declare an async function and use it in one of the
apply
calls, right?clever-sunset-76585
09/19/2019, 5:16 PMComponentResource
, that way the non-Pulumi thing acts as a resource and hence plays well with Outputs
and such.No matter how you like to participate in developer communities, Pulumi wants to meet you there. If you want to meet other Pulumi users to share use-cases and best practices, contribute code or documentation, see us at an event, or just tell a story about something cool you did with Pulumi, you are part of our community.
Powered by