Hi I'm having some problems with `interpolate` and...
# typescript
g
Hi I'm having some problems with
interpolate
and I can't figure out what I'm doing wrong. Here's my code: https://gist.github.com/zombor/43cd30735aa72bc02be4ef878aa073c6 I'm guessing this has to do with some kind of aysnc problem, but the docs on
interpolate
suggest this should "just work". Anyone know what I'm doing wrong? I would expect the output of
foo
on L25 to be either
undefined
or some kind of actual string.
t
Your
apply
on line 24 and
interpolate
on line 29 aren't doing anything. You can just remove them with the same effect.
Apply returns an Output, so the console output makes sense
Your exports should be fine though
g
this was just an example. my actual usage is a bit more complicated. I'm trying to match the role name in a loop in another part of my program. Shouldn't I be able to do an interpolate and assign to a variable then print it out?
t
Generally, no. Interpolate returns another output, not a raw string. You can't convert any output to raw value: the value might not be known at the point when you ask.
g
so is there any way that I can take a list like
["foo", "bar"]
and match them to an output value?
t
You could do that inside
apply
g
tries
yes, i think this is what I need. Thank you!