async script setup support (Top-level 'await')
See original GitHub issueWhen checking a component with an async script setup like:
<script setup lang="ts">
const pendingMessage = await Promise.resolve('Hello');
</script>
then Volar throws:
src/components/HelloWorld.vue:8:24 - error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext' or 'system', and the 'target' option is set to 'es2017' or higher.
8 const pendingMessage = await Promise.resolve('Hello');
That makes sense, and we can workaround it by updating the target to es2017 but I was wondering if that could be supported out of the box?
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Vue <script setup> Top level await causing template not to ...
I'm using the new syntax in Vue 3 and I really like the idea of it, but once I tried to use a...
Read more >Better support for top-level await in <script setup> · Issue #4960
Currently a top-level await in a <script setup> block causes the template not to render, see this StackOverflow question.
Read more >Vue: <script setup> top-Level await causes typescript compiler ...
Right. Suspense (the feature to consume an async setup()) is still experimental since the API for using the Suspense component may change, ...
Read more ><script setup> | Vue.js
Top -level await #. Top-level await can be used inside <script setup> . The resulting code will be compiled as async setup() ...
Read more >TypeScript's New Top-Level Await - Better Programming
In this article, I want to show you that it is possible to finally use top-level await instead of wrapping it between an...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@rafasoares try add
@WTFace It’s only for
<script setup>
but not for .ts.