Skip to content

Commit 4ddff6f

Browse files
authored
fix: adjust module declaration to work around language tools bug (#12071)
See sveltejs/language-tools@0261112 for more info We can probably remove this after a few weeks
1 parent 29ca451 commit 4ddff6f

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

.changeset/slow-ligers-enjoy.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"svelte": patch
3+
---
4+
5+
fix: adjust module declaration to work around language tools bug

packages/svelte/src/ambient.d.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
declare module '*.svelte' {
2-
import { SvelteComponent, Component, type ComponentConstructorOptions } from 'svelte';
2+
// use prettier-ignore for a while because of https://github.com/sveltejs/language-tools/commit/026111228b5814a9109cc4d779d37fb02955fb8b
3+
// prettier-ignore
4+
import { SvelteComponent, Component, type ComponentConstructorOptions } from 'svelte'
35

46
// Support using the component as both a class and function during the transition period
7+
// prettier-ignore
58
interface ComponentType {
69
(
710
...args: Parameters<Component<Record<string, any>>>
8-
): ReturnType<Component<Record<string, any>, Record<string, any>>>;
9-
new (o: ComponentConstructorOptions): SvelteComponent;
11+
): ReturnType<Component<Record<string, any>, Record<string, any>>>
12+
new (o: ComponentConstructorOptions): SvelteComponent
1013
}
1114
const Comp: ComponentType;
1215
type Comp = SvelteComponent;

packages/svelte/types/index.d.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2634,14 +2634,17 @@ declare module 'svelte/types/compiler/interfaces' {
26342634
*/
26352635
type Namespace = 'html' | 'svg' | 'mathml' | 'foreign';
26362636
}declare module '*.svelte' {
2637-
import { SvelteComponent, Component, type ComponentConstructorOptions } from 'svelte';
2637+
// use prettier-ignore for a while because of https://github.com/sveltejs/language-tools/commit/026111228b5814a9109cc4d779d37fb02955fb8b
2638+
// prettier-ignore
2639+
import { SvelteComponent, Component, type ComponentConstructorOptions } from 'svelte'
26382640

26392641
// Support using the component as both a class and function during the transition period
2642+
// prettier-ignore
26402643
interface ComponentType {
26412644
(
26422645
...args: Parameters<Component<Record<string, any>>>
2643-
): ReturnType<Component<Record<string, any>, Record<string, any>>>;
2644-
new (o: ComponentConstructorOptions): SvelteComponent;
2646+
): ReturnType<Component<Record<string, any>, Record<string, any>>>
2647+
new (o: ComponentConstructorOptions): SvelteComponent
26452648
}
26462649
const Comp: ComponentType;
26472650
type Comp = SvelteComponent;

0 commit comments

Comments
 (0)