sveltejs/svelte-preprocess

Typescript in template code

redmagic opened this issue · 2 comments

Describe the bug
I am using a nullish coalescing operator in template code, like so <span>{$someStore.someProperty ?? ''}</span>

Logs
Nothing special is logged

To Reproduce
Clone from https://github.com/redmagic/transpile-template-code
npm i
npm start
Inspect file dist/main.js and search for "123", here you can see the ?? is not transpiled

Expected behavior
The operator should be transpiled like here: https://www.typescriptlang.org/play?target=2#code/MYewdgziA2CmB00QHMAUBXMATWAzAlmLFgAQD8ZJATAJRA

Hey @redmagic 👋

Currently using typescript in expressions inside your markup is not supported. This is kind of being discussed on: #318.

I've added a note about this on the TypeScript limitations section: https://github.com/sveltejs/svelte-preprocess/blob/main/docs/preprocessing.md#typescript---limitations

Hi there!

Thanks for your quick reply, I'll keep an eye on that disscussion, closing this.