Skip to content

Parser doesn't support generics attribute in a script tag #4

@Sockitos

Description

@Sockitos

Hi,

I'm using this package https://github.com/barvian/sveltekit-document on my project which depends on svelte-parse-markup.
When building my svelte project, I'm encountering the following error while parsing the markup:

ParseError: Error while preprocessing .../form-field.svelte - Expected =
.
.
.
at parse (file:///Users/jrn/Documents/GitHub/community/node_modules/svelte-parse-markup/index.js:65:15)

File in question:

<script lang="ts" context="module">
	import type { FormPath, SuperForm } from "sveltekit-superforms";
	type T = Record<string, unknown>;
	type U = FormPath<T>;
</script>

<script lang="ts" generics="T extends Record<string, unknown>, U extends FormPath<T>">
	import type { HTMLAttributes } from "svelte/elements";
	import * as FormPrimitive from "formsnap";
	import { cn } from "$lib/utils.js";

	type $$Props = FormPrimitive.FieldProps<T, U> & HTMLAttributes<HTMLElement>;

	export let form: SuperForm<T>;
	export let name: U;

	let className: $$Props["class"] = undefined;
	export { className as class };
</script>

<FormPrimitive.Field {form} {name} let:constraints let:errors let:tainted let:value>
	<div class={cn("space-y-2", className)}>
		<slot {constraints} {errors} {tainted} {value} />
	</div>
</FormPrimitive.Field>

This is happening specifically on 4 files and the only thing I found in common was the use of the generics attribute.

Thanks for your work and I hope this can be solved
Meanwhile, is there a way to exclude these files from?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions