Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use script setup alongside export default will got compile error when exporting types #4918

Closed
upupming opened this issue Nov 8, 2021 · 1 comment

Comments

@upupming
Copy link

upupming commented Nov 8, 2021

Version

3.2.21

Reproduction link

sfc.vuejs.org/

Steps to reproduce

Use as guide: https://github.com/vuejs/rfcs/blob/master/active-rfcs/0040-script-setup.md#usage-alongside-normal-script

This works (only export variable).

This breaks (export type and reference it in the script setup).

What is expected?

No compile error

What is actually happening?

Got compile error like this:

[plugin:vite:vue] Transform failed with 1 error:
/Users/upupming/projects/vue3-compact-template/src/components/Demo.vue:16:27: error: Expected ";" but found "++"
/Users/upupming/projects/vue3-compact-template/src/components/Demo.vue:16:27
Expected ";" but found "++"
14 |    expose()
15 |  
16 |  const props = __props as ue++
   |                             ^
17 |  }
18 |
    at failureErrorWithLog (/Users/upupming/projects/vue3-compact-template/node_modules/.pnpm/esbuild@0.13.12/node_modules/esbuild/lib/main.js:1493:15)
    at /Users/upupming/projects/vue3-compact-template/node_modules/.pnpm/esbuild@0.13.12/node_modules/esbuild/lib/main.js:1282:29
    at /Users/upupming/projects/vue3-compact-template/node_modules/.pnpm/esbuild@0.13.12/node_modules/esbuild/lib/main.js:629:9
    at handleIncomingPacket (/Users/upupming/projects/vue3-compact-template/node_modules/.pnpm/esbuild@0.13.12/node_modules/esbuild/lib/main.js:726:9)
    at Socket.readFromStdout (/Users/upupming/projects/vue3-compact-template/node_modules/.pnpm/esbuild@0.13.12/node_modules/esbuild/lib/main.js:596:7)
    at Socket.emit (events.js:400:28)
    at addChunk (internal/streams/readable.js:290:12)
    at readableAddChunk (internal/streams/readable.js:265:9)
    at Socket.Readable.push (internal/streams/readable.js:204:10)
    at Pipe.onStreamRead (internal/stream_base_commons.js:188:23

But volar static type checking is okay with no error:

image

@posva
Copy link
Member

posva commented Nov 8, 2021

Duplicate of #4423

@posva posva marked this as a duplicate of #4423 Nov 8, 2021
@posva posva closed this as completed Nov 8, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Oct 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants