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

<script setup generic="..."> is broken in Vue 3.4.0 #9890

Closed
ByScripts opened this issue Dec 21, 2023 · 1 comment
Closed

<script setup generic="..."> is broken in Vue 3.4.0 #9890

ByScripts opened this issue Dec 21, 2023 · 1 comment
Labels

Comments

@ByScripts
Copy link

ByScripts commented Dec 21, 2023

Vue version

3.4.0-beta.4

Link to minimal reproduction

https://play.vuejs.org/#eNqVU8tu2zAQ/BWCZ4sq4JxcN0hbpEB7aIs0R14UcaMw5QvLlWMg8L93SdmpZARBexK5MxzNDpfP8mNKajeC3MgtgU+uI7jUQYdtu9zmHm0i4bowfNCSspYiA43pSJ5g3sgVg30M93ZQjzkGFn7WQQgt++iTdYA/EtkYWGAjKlKwzrn49K3WCEdYner9A/S/X6k/5n2pafkTIQPuQMsXjDocgCb4+td32PP6BfTRjI7Zb4A3kKMbi8eJ9mkMhm3PeNXtV58ikg3Dbb7eE4R8aqoYLcxD5WvJ6X5+o/W/dtdqXc/pcOAUbdVvfJfOcpyApQj/YzL7QJTypm17E/iYAWd3qAJQG5Jvr5jW4hjIemhM9FdrdaHeNXdAnbpojc00RxVk39xhfOKAVcJoWHAWQtGq0WODEAxgiejfLJwde8XGGWNhpbiY5VSyPU3wcUjrYIoBAqDteVpvBd8zS2VxA31Es82EfHErMX0vteTBnWIVX2IU9xg9N6Ja3hRpLd8vZpw3s8chxNbYXV3wMrtIop3K3EupL54SOz6qnj25/5Q5/AFjokEt

Steps to reproduce

Open Comp.vue component, select Vue 3.4.0-beta.4, and make some edit (add a space for example) to trigger the compiler.

Then, if you replace generic="T extends Record<string, string>" with generic="T extends object", the problem disappear.

Removing import Foo from "./Foo.vue" make the error to disappear too.

What is expected?

generic="..." should accept any extends

What is actually happening?

generic="..." no longer accepts to extends another generic type (containing a < character)

SyntaxError: [vue/compiler-sfc] Unterminated string constant. (1:0)

src/Comp.vue
1  |  <script setup generic="T extends Record<string, string>">
   |                                                         ^
2  |  import Foo from "./Foo.vue"; 
3  |  </script>
    at constructor (https://cdn.jsdelivr.net/npm/@vue/[email protected]/dist/compiler-sfc.esm-browser.js:2499:19)
    at Parser.raise (https://cdn.jsdelivr.net/npm/@vue/[email protected]/dist/compiler-sfc.esm-browser.js:5366:19)
    at Object.unterminated (https://cdn.jsdelivr.net/npm/@vue/[email protected]/dist/compiler-sfc.esm-browser.js:4369:20)
    at readStringContents (https://cdn.jsdelivr.net/npm/@vue/[email protected]/dist/compiler-sfc.esm-browser.js:4107:16)
    at Parser.readString (https://cdn.jsdelivr.net/npm/@vue/[email protected]/dist/compiler-sfc.esm-browser.js:5252:9)

System Info

System:
    OS: macOS 14.0
    CPU: (10) arm64 Apple M2 Pro
    Memory: 105.67 MB / 16.00 GB
    Shell: 3.6.1 - /opt/homebrew/bin/fish
  Binaries:
    Node: 21.4.0 - /opt/homebrew/bin/node
    Yarn: 1.22.21 - /opt/homebrew/bin/yarn
    npm: 10.2.4 - /opt/homebrew/bin/npm
    pnpm: 8.5.1 - ~/Library/pnpm/pnpm
    bun: 1.0.13 - /opt/homebrew/bin/bun
  Browsers:
    Brave Browser: 120.1.61.104
    Chrome: 120.0.6099.129
  npmPackages:
    vue: 3.4.0-beta.4 => 3.4.0-beta.4

Any additional comments?

I tried all versions of 3.4 and the problem seems to have appeared in 3.4.0-alpha.2.

Use the version selector on top right, choose alpha.1, make some edit to recompile (add a space anywhere for example) => Problem gone.

Choose alpha.2, make some edit => Problem is back.

@yyx990803
Copy link
Member

Closed via 7aa3f25

@github-actions github-actions bot locked and limited conversation to collaborators Jan 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants