-
-
Notifications
You must be signed in to change notification settings - Fork 202
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: ensure hoisted interfaces are moved after hoisted imports (#2597)
#2594 As a drive-by, I also ensures that the dts generation knows about the hoisted interfaces so it does not transform them into types anymore
- Loading branch information
1 parent
c21de66
commit a1b4a64
Showing
10 changed files
with
81 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
packages/svelte2tsx/test/emitDts/samples/typescript-runes.v5/expected/TestRunes2.svelte.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
import type { X } from './x'; | ||
/** asd */ | ||
type Props = { | ||
interface Props { | ||
foo: string; | ||
bar?: X; | ||
}; | ||
import type { X } from './x'; | ||
} | ||
declare const TestRunes2: import("svelte").Component<Props, {}, "">; | ||
type TestRunes2 = ReturnType<typeof TestRunes2>; | ||
export default TestRunes2; |
6 changes: 3 additions & 3 deletions
6
packages/svelte2tsx/test/svelte2tsx/samples/ts-runes-hoistable-props-1.v5/expectedv2.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
packages/svelte2tsx/test/svelte2tsx/samples/ts-runes-hoistable-props-2.v5/expectedv2.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
packages/svelte2tsx/test/svelte2tsx/samples/ts-runes-hoistable-props-4.v5/expectedv2.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
packages/svelte2tsx/test/svelte2tsx/samples/ts-runes-hoistable-props-5.v5/expectedv2.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
///<reference types="svelte" /> | ||
; | ||
import X from './X'; | ||
;; | ||
|
||
import { readable } from 'svelte/store'; | ||
; | ||
|
||
/** I should not be sandwitched between the imports */ | ||
interface Props { | ||
foo?: string; | ||
};function render() { | ||
|
||
|
||
|
||
const store = readable(1)/*Ωignore_startΩ*/;let $store = __sveltets_2_store_get(store);/*Ωignore_endΩ*/ | ||
|
||
let { foo }: Props = $props() | ||
; | ||
async () => { | ||
|
||
|
||
|
||
$store;}; | ||
return { props: {} as any as Props, exports: {}, bindings: __sveltets_$$bindings(''), slots: {}, events: {} }} | ||
const Input__SvelteComponent_ = __sveltets_2_fn_component(render()); | ||
type Input__SvelteComponent_ = ReturnType<typeof Input__SvelteComponent_>; | ||
export default Input__SvelteComponent_; |
17 changes: 17 additions & 0 deletions
17
packages/svelte2tsx/test/svelte2tsx/samples/ts-runes-hoistable-props-5.v5/input.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<script module> | ||
import X from './X'; | ||
</script> | ||
|
||
<script lang="ts"> | ||
import { readable } from 'svelte/store'; | ||
const store = readable(1) | ||
/** I should not be sandwitched between the imports */ | ||
interface Props { | ||
foo?: string; | ||
} | ||
let { foo }: Props = $props() | ||
</script> | ||
|
||
{$store} |
2 changes: 1 addition & 1 deletion
2
packages/svelte2tsx/test/svelte2tsx/samples/ts-runes.v5/expectedv2.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...tsx/test/svelte2tsx/samples/ts-sveltekit-autotypes-$props-rune-unchanged.v5/expectedv2.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters