#[JS] string interpolation not working for some reason

1 messages · Page 1 of 1 (latest)

winter wraith
#

hey, for some reason this simple code doesn't work:
https://www.typescriptlang.org/play/?#code/MYewdgzgLgBAlmOUDqBDCBbAggBxzAXhgApU8A5VDAUwC4ZoAnBAcwEpCA+GAbwCgYMUJBAAbagDpRIFqQpVqAGhgADAMQASHmRyUaAXxVsA3H32m+CJGky4cxAETBUAN1QOTQA

i mean, it obviously works in the playground as expected
but when i use the same code in the browser by puting it inside a script tag, it doesn't

#

this works:

console.log("#" + appName);
static dust
#

your code is not JS

#

it's TS

#

browsers do not understand TS

#

(also, it's called a template string)

winter wraith
#

oh okok template string thx
but yes i know, i added the types only for the ts playground

#

but if i had the types, i would get an error

#

here, only the templated string isn't working

#

appName works
"#" + appName works
#${appName} doesnt

#

the error has nothing to do with this piece of code

#

no the ss

static dust
#

works for me

#

in-browser

winter wraith
#

in the console yes, but not in a script tag inside the body

#

ohhhhhhhh

#

ok lol

#
foreach(file "index.html" "run_webassembly.py")
  configure_file("src/${file}" ${file})
endforeach(file)

because of cmake :')

#

makes sense

static dust
#

ahh you were using some build pipeline

#

makes sense

#

yeah your JS (TS) code was fine

winter wraith
#

yupp thx for the help!

#

have a nice day/evening 🙏