diff --git a/packages/svelte2tsx/src/svelte2tsx/nodes/ExportedNames.ts b/packages/svelte2tsx/src/svelte2tsx/nodes/ExportedNames.ts index fdf0ecfbf..73a7b6707 100644 --- a/packages/svelte2tsx/src/svelte2tsx/nodes/ExportedNames.ts +++ b/packages/svelte2tsx/src/svelte2tsx/nodes/ExportedNames.ts @@ -184,7 +184,11 @@ export class ExportedNames { generic_arg.end + this.astOffset, node.parent.pos + this.astOffset ); - this.str.appendRight(generic_arg.end + this.astOffset, this.$props.type); + this.str.appendRight( + generic_arg.end + this.astOffset, + // so that semantic tokens ignore it, preventing an overlap of tokens + surroundWithIgnoreComments(this.$props.type) + ); } } else { if (!this.isTsFile) { diff --git a/packages/svelte2tsx/test/svelte2tsx/samples/ts-runes-generics/expectedv2.ts b/packages/svelte2tsx/test/svelte2tsx/samples/ts-runes-generics/expectedv2.ts index 8ee4f9c16..e2a415314 100644 --- a/packages/svelte2tsx/test/svelte2tsx/samples/ts-runes-generics/expectedv2.ts +++ b/packages/svelte2tsx/test/svelte2tsx/samples/ts-runes-generics/expectedv2.ts @@ -1,7 +1,7 @@ /// ;function render() { ;type $$ComponentProps = { a: T, b: string }; - let { a, b }:$$ComponentProps = $props(); + let { a, b }:/*Ωignore_startΩ*/$$ComponentProps/*Ωignore_endΩ*/ = $props(); let x = $state(0); let y = $derived(x * 2); ; diff --git a/packages/svelte2tsx/test/svelte2tsx/samples/ts-runes/expectedv2.ts b/packages/svelte2tsx/test/svelte2tsx/samples/ts-runes/expectedv2.ts index a79725a86..a4b6020df 100644 --- a/packages/svelte2tsx/test/svelte2tsx/samples/ts-runes/expectedv2.ts +++ b/packages/svelte2tsx/test/svelte2tsx/samples/ts-runes/expectedv2.ts @@ -1,7 +1,7 @@ /// ;function render() { ;type $$ComponentProps = { a: number, b: string }; - let { a, b }:$$ComponentProps = $props(); + let { a, b }:/*Ωignore_startΩ*/$$ComponentProps/*Ωignore_endΩ*/ = $props(); let x = $state(0); let y = $derived(x * 2); ; diff --git a/packages/svelte2tsx/test/svelte2tsx/samples/ts-sveltekit-autotypes-$props-rune-unchanged/expectedv2.ts b/packages/svelte2tsx/test/svelte2tsx/samples/ts-sveltekit-autotypes-$props-rune-unchanged/expectedv2.ts index 6699fbec3..d9d8a85dc 100644 --- a/packages/svelte2tsx/test/svelte2tsx/samples/ts-sveltekit-autotypes-$props-rune-unchanged/expectedv2.ts +++ b/packages/svelte2tsx/test/svelte2tsx/samples/ts-sveltekit-autotypes-$props-rune-unchanged/expectedv2.ts @@ -2,7 +2,7 @@ ;function render() { const snapshot: any = {};;type $$ComponentProps = {form: boolean, data: true }; - let { form, data }:$$ComponentProps = $props(); + let { form, data }:/*Ωignore_startΩ*/$$ComponentProps/*Ωignore_endΩ*/ = $props(); ; async () => {}; return { props: {} as any as $$ComponentProps, exports: {} as any as { snapshot: any }, slots: {}, events: {} }}