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
An error occurred while installing the chart component #520
Comments
Are you using TypeScript or JavaScript project? |
javascript |
same here. using javascript too. |
I've found the problem, javascript vue projects cannot use chart components directly, If you download the chart component in a js project, the interface.ts in chart folder is empty and must configure typescript to use it. |
I'm confused as to why the Vue compiler doesn't include a feature to convert Vue/TS to Vue/JS (preserve the code only remove TypeScript codes). We are using cc @sxzz Hey Kevin can you give us an input about Vue compiler? For example, we want something like this Vue/TS<script setup lang="ts">
const props = withDefault(defineProps<{ foo?: string }>(), {
foo: 'test'
})
</script> Vue/JS<script setup lang="ts">
const props = defineProps({
foo: { type: String, required: false, default: 'test' }
})
</script>
|
The Vue compiler uses This allows users to incorporate additional transformers (such as swc, babel, esbuild) for converting TS to JS if required. |
After reading the context, if I haven't misunderstood, is there a need for such a tool: to convert TS Vue SFC example code in documents into TS for JS users to read? |
shadcn-vue components are written in TypeScript In shadcn-vue, we need a proper solution for transforming Vue/TS (script setup lang="ts") to Vue/JS (script setup) For JavaScript users, @Dunqing worked on detypes pkg to remove TypeScript code from the Vue components while we installing components with shadcn-vue CLI, but it's not complete and not working in some cases like Chart We are asking if there is a better way with the Vue compiler to preserve the code but remove TypeScript code? |
In the Vue compiler, this feature indeed does not exist. It's beyond what Vue itself requires. |
@Dunqing might need your help here. We have some template inline function with types, and eg: <VisLine
:x="(d: Data, i: number) => i"
:y="(d: Data) => d[category]"
/> I'm expecting that the types in template would be remove as well. |
Thank you for your feedback. I will take a look this week. Also, I plan to refactor the transform for vue file. The current implementation is hard to maintain and has many bugs 😅. And I think shadcn-svelte handles it better, which will avoid errors on the user side. When I have more time I will refactor in this direction. |
I just started learning vue and shadcn and couldn't find the problem
The text was updated successfully, but these errors were encountered: