FYI, just want to let you guys know that I'm writing this AWS CDK app with:
cdk --version
on my bash terminalHi everyone, I'm very VERY new to AWS CDK and currently I'm still playing around with it. So far I feel like it definitely offers so much more flexibility compared to typing cloudformation template.
However, one thing that I can't figure out is how to output values of a variable just like System.println()
in Java or console.log
in JavaScript
Now, I'm very new to TypeScript but so far I've tried using console.log() command in one of the TypeScript files and it just doesn't allow me to use it:
Everytime I try to do this:
console.log(name); //name is a string
I get this in visual studio:
It honestly doesn't help that I'm very new to TypeScript as well so that also comes into play with me having difficulty learning AWS CDK (but still, I'm loving it so far)
I already have the console node module installed in the cdk app project folder ./node_modules
right here:
~Any help would be greatly appreciated~
Thanks so much in advance! :)
I found out a way to do it, it's all good now.
Basically you can use console.log(name)
in order to print out to terminal when doing cdk synth
but there are 2 things I need to do before I can use it.
1.) I need to have import console = require('console');
at the top of the TypeScript file
2.) I need run npm install @types/console
to fix some errors regarding the console being of any
type
Anyway, it's all fixed now :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With