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

npx shadcn-svelte@next does not respect typescript=false #1365

Closed
rjrs23 opened this issue Oct 27, 2024 · 2 comments
Closed

npx shadcn-svelte@next does not respect typescript=false #1365

rjrs23 opened this issue Oct 27, 2024 · 2 comments
Assignees
Labels
next An issue related to the @next release. type: bug A confirmed report of unexpected behavior in the application

Comments

@rjrs23
Copy link

rjrs23 commented Oct 27, 2024

Describe the bug

I do not use typescript in my project and adding components with npx shadcn-svelte@next add card results in adding components that use typescript and types.

I do have typescript: false in components.json

  1. Is this expected behaviour?
  2. Even if this is expected behaviour two issues persist, lang=ts is not added to the <script tag>
  3. In case of button where it has <script module> and also <script> the cli surprisingly added the lang=ts for the <script module> but not for <script> tag.

Reproduction

run npx shadcn-svelte@next add card

with the below components.json

{
	"$schema": "https://next.shadcn-svelte.com/schema.json",
	"style": "default",
	"tailwind": {
		"config": "tailwind.config.js",
		"css": "src/app.pcss",
		"baseColor": "slate"
	},
	"aliases": {
		"components": "$lib/components",
		"utils": "$lib/utils",
		"ui": "$lib/components/ui",
		"hooks": "$lib/hooks"
	},
	"typescript": false,
	"registry": "https://next.shadcn-svelte.com/registry"
}

results in

<script>
	import type { WithElementRef } from "bits-ui";
	import type { HTMLAttributes } from "svelte/elements";
	import { cn } from "$lib/utils.js";

	let {
		ref = $bindable(null),
		class: className,
		children,
		...restProps
	}: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
</script>

<div
	bind:this={ref}
	class={cn("bg-card text-card-foreground rounded-lg border shadow-sm", className)}
	{...restProps}
>
	{@render children?.()}
</div>

Logs

No response

System Info

System:
    OS: Linux 5.15 Ubuntu 20.04.6 LTS (Focal Fossa)
    CPU: (4) x64 Intel(R) Core(TM) i5-4440 CPU @ 3.10GHz
    Memory: 5.68 GB / 14.57 GB
    Container: Yes
    Shell: 5.0.17 - /bin/bash
  Binaries:
    Node: 20.14.0 - ~/.nvm/versions/node/v20.14.0/bin/node
    npm: 10.7.0 - ~/.nvm/versions/node/v20.14.0/bin/npm
    pnpm: 8.7.5 - ~/.local/share/pnpm/pnpm
  Browsers:
    Chrome: 129.0.6668.100
  npmPackages:
    @sveltejs/kit: ^2.0.0 => 2.7.3 
    bits-ui: ^1.0.0-next.28 => 1.0.0-next.28 
    lucide-svelte: ^0.453.0 => 0.453.0 
    svelte: ^5.0.0 => 5.1.3

Severity

annoyance

@harryqt
Copy link

harryqt commented Oct 27, 2024

Just came here to report this exact same issue.

@AdrianGonz97 AdrianGonz97 self-assigned this Oct 27, 2024
@huntabyte huntabyte added type: bug A confirmed report of unexpected behavior in the application next An issue related to the @next release. labels Oct 27, 2024
@huntabyte
Copy link
Owner

Fixed - just wait for the current next deployment to finish and you should be good to go! Thanks @AdrianGonz97 !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
next An issue related to the @next release. type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
Development

No branches or pull requests

4 participants