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

🐛 parse error when using generic component in vue files #2456

Closed
1 task done
Jungzl opened this issue Apr 15, 2024 · 3 comments · Fixed by #2457
Closed
1 task done

🐛 parse error when using generic component in vue files #2456

Jungzl opened this issue Apr 15, 2024 · 3 comments · Fixed by #2457
Assignees
Labels
A-Project Area: project S-Bug-confirmed Status: report has been confirmed as a valid bug

Comments

@Jungzl
Copy link

Jungzl commented Apr 15, 2024

Environment information

CLI:
  Version:                      1.6.4
  Color support:                true

Platform:
  CPU Architecture:             x86_64
  OS:                           windows

Environment:
  BIOME_LOG_DIR:                unset
  NO_COLOR:                     unset
  TERM:                         unset
  JS_RUNTIME_VERSION:           unset
  JS_RUNTIME_NAME:              unset
  NODE_PACKAGE_MANAGER:         unset

Biome Configuration:
  Status:                       Loaded successfully
  Formatter disabled:           false
  Linter disabled:              true
  Organize imports disabled:    false
  VCS disabled:                 true

Workspace:
  Open Documents:               0

What happened?

when using generic component in vue like below:

<script generic="T extends Record<string, any>" lang="ts" setup>
//...
</script>

it throws error:

xx.vue:1:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  × 'import type' are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax.
  
  > 1 │ <script generic="T extends Record<string, any>" lang="ts" setup>
      │          ^^^^^^^^^^^^^^^^^^^^^^^^^
    2 │   import type { VNode } from 'vue'
  
  i TypeScript only syntax

Expected result

parse generic component success without errors

Code of Conduct

  • I agree to follow Biome's Code of Conduct
@ematipico ematipico added A-Project Area: project S-Bug-confirmed Status: report has been confirmed as a valid bug labels Apr 15, 2024
@ematipico
Copy link
Member

That's a weird error

@Sec-ant
Copy link
Member

Sec-ant commented Apr 15, 2024

This is the issue of the regexes we use 😓. I'll look into it.

@whschultz
Copy link

While there's no error being thrown, it does appear this still isn't working. Generic types defined by these generic components aren't recognized within the script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Project Area: project S-Bug-confirmed Status: report has been confirmed as a valid bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants