Closed calvinrbnspiess closed 10 months ago
After further reading I discovered, that is behaviour is intentional. Whenever someone defines the property define:vars
on a script tag, it will inherit the is:inline
directive as stated in the big yellow warning on this docs page: https://docs.astro.build/en/reference/directives-reference/#definevars
Inline script won't be bundled and won't be processed by typescript, sadly.
Would be nice if that could get added. I've had to remove the types so many times now because I at some point realize that I need define:vars
.
At this point I'm considering to just not use typescript. But I would honestly prefer that typescript would be transpiled also when it inline.
Describe the Bug
Hello! I'm currently experiencing the following issue. When using the astro language tools inside VS Code, I'm getting typescript errors like "Type assertion expressions can only be used in TypeScript files.ts(8016)".
Generally the typ checking is working flawlessly, however this odd error appears when I'm adding the
define:vars
property.The lack for define:vars is mentioned inside this pull request: https://github.com/withastro/language-tools/pull/263
Is this behaviour still intentional? Are there any workarounds till this gets fixed?
This is working:
This is not working:
My
tscconfig.json
:Extension (astro-build.astro-vscode) version: v2.6.2 VS Code version: 1.85.1 (Universal)
Steps to Reproduce
define:vars={{ title: "test " }}