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

warning: unplugin-vue-better-define SyntaxError: Cannot resolve TS type: X (Nuxt + vue-macros + radix-vue) #532

Open
5 tasks done
sondh0127 opened this issue Oct 20, 2023 · 6 comments
Labels
enhancement New feature or request

Comments

@sondh0127
Copy link

sondh0127 commented Oct 20, 2023

Describe the bug

Hello macros team. I've seen similar closed issues, but I guess this one is different. As well as the limitation. In the example below, I expect the warning to not appear.
image

image

component code

<script setup lang="ts">
import { Label, type LabelProps } from 'radix-vue'
import { cn } from '@/lib/utils'

const props = defineProps<LabelProps & { class?: string }>()
</script>

<template>
  <Label
    v-bind="props"
    :class="
      cn(
        'block text-sm tracking-tight font-medium text-foreground text-left',
        props.class,
      )
    "
  >
    <slot />
  </Label>
</template>

Reproduction

https://github.com/sondh0127/nuxt-macro.git

System Info

System:
    OS: macOS 13.6
    CPU: (10) arm64 Apple M1 Pro
    Memory: 123.92 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.13.0 - ~/Library/Caches/fnm_multishells/72786_1697772348189/bin/node
    Yarn: 1.22.19 - ~/Library/Caches/fnm_multishells/72786_1697772348189/bin/yarn
    npm: 8.19.3 - ~/Library/Caches/fnm_multishells/72786_1697772348189/bin/npm
    Watchman: 2023.08.07.00 - /opt/homebrew/bin/watchman
  Browsers:
    Brave Browser: 117.1.58.137
    Chrome: 118.0.5993.88
    Safari: 16.6

Used Package Manager

yarn

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.
@sondh0127
Copy link
Author

@sxzz I hope you will have time for this. Many thanks

@sxzz
Copy link
Member

sxzz commented Oct 26, 2023

betterDefine cannot resolve all the cases. It's very limited. It can only be fixed case by case. We will fix it soon.

BTW, We're looking for a better solution for declaring props/emits.

@sxzz sxzz added the enhancement New feature or request label Oct 26, 2023
@sondh0127
Copy link
Author

sondh0127 commented Oct 26, 2023

Thank you for the information. @sxzz
*P/S: I saw that the normal defineProps work ok without warning. (if I turn off the macro module)
The type import for props is something default in Vue 3.3 according to the docs.
image
I tried betterDefine: false, but it doesn't seem to be working
image
image

@aviorp
Copy link

aviorp commented Jan 17, 2024

any news ?

@A-kirami
Copy link

A-kirami commented Mar 2, 2024

Has it made any progress?

@sondh0127
Copy link
Author

sondh0127 commented Mar 3, 2024

image

turn it off but you must be carefully with defineEmits by use the old syntax

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants