Untitled.ts
# typescript
b
Untitled.ts
c
You can simplify that and write the file inside the
.apply()
.
Copy code
eks_cluster.kubeconfigJson.apply((kubeconfig) => writeFileSync("kubeconfig.json", kubeconfig, { flag: "w" }));
Basically, the closure passed to
apply()
will run only when
eks_cluster.kubeconfigJson
is actually available.
b
thanks, like a charm
I was using pulumi with Python and now migrating some stuff to typescript, any suggestions for a newcomer in typescritp?
c
I recommend looking at the examples repo (https://github.com/pulumi/examples) and generally using the Pulumi Docs website (https://pulumi.com/docs). Many of the core concepts are represented in a multi-language way which makes it easy to see how something is written in each of the supported languages. As for general TypeScript stuff, I think the official docs website for TS does a good job of explaining everything you can do with that language. They also have a live playground site that you can use to practice small code snippets. https://www.typescriptlang.org/docs/ https://www.typescriptlang.org/play