https://pulumi.com logo
o

orange-tailor-85423

10/19/2018, 11:56 PM
therefore, when the calling script calls this file.... it will run the loop?
w

white-balloon-205

10/20/2018, 12:04 AM
Yep - as long as you import this file, all the code in it will run.
c

creamy-potato-29402

10/20/2018, 1:58 AM
Programming is confusing lol 🙂
r

rough-oil-1458

10/21/2018, 12:57 AM
Programming is hard 🙂
o

orange-tailor-85423

10/22/2018, 12:02 AM
well it's very confusing for me... :-$
🙂
g

glamorous-printer-66548

10/22/2018, 2:58 AM
There’s actually a small gotcha in TypeScript. When you import something like this:
import something from './something'
but don’t actually use any of the imported symbols in the file where you import it (i.e. in this case the symbol is
something
) or you’re only importing a type, but not a value, the generated runtime code will not load the module, even if you have specified the import. This is kind of an implicit dead code / unused import removal. If you want to import a file just for it’s side-effects, without using any of it’s exported symbols, you have to write simply:
import './something'
. This will always load the module. Here’s a bit more info on that behaviour: https://github.com/Microsoft/TypeScript/wiki/FAQ#why-are-imports-being-elided-in-my-emit
👍 2