-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Closed
Labels
Description
Describe the bug
When I have a component which includes function overloading (inside <script module>):
export function test(
type: 'test',
props: {test: number}
): void;
export function test(type: 'test2'): void;
export function test(type: string, props?: Record<string, any>) {
console.log(type, props);
}
Everything seens fine on the IDE but I still get this weird Rollup Error when running Vite or on the Playground:
[vite] Error when evaluating SSR module /src/routes/+layout.server.ts:
|- RollupError: Expected '{', got ';'
at getRollupError (file:///D:/Coding/Projetos/Playably/github/advent-calendar-template/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/parseAst.js:396:41)
at convertProgram (file:///D:/Coding/Projetos/Playably/github/advent-calendar-template/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/parseAst.js:1084:26)
at parseAstAsync (file:///D:/Coding/Projetos/Playably/github/advent-calendar-template/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/parseAst.js:2070:106)
at async ssrTransformScript (file:///D:/Coding/Projetos/Playably/github/advent-calendar-template/node_modules/.pnpm/[email protected]_@[email protected]/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:52381:11)
at async loadAndTransform (file:///D:/Coding/Projetos/Playably/github/advent-calendar-template/node_modules/.pnpm/[email protected]_@[email protected]/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:51979:72)
at async instantiateModule (file:///D:/Coding/Projetos/Playably/github/advent-calendar-template/node_modules/.pnpm/[email protected]_@[email protected]/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:52874:44)
Reproduction
https://svelte.dev/playground/721e958b91b744a192d9557d007fd316?version=5.2.9
<script module lang="ts">
// Component.svelte
export function test(
type: 'test',
props: {test: number}
): void;
export function test(type: 'test2'): void;
export function test(type: string, props?: Record<string, any>) {
console.log(type, props);
}
</script>Logs
No response
System Info
System:
OS: Windows 10 10.0.19045
CPU: (24) x64 AMD Ryzen 9 3900X 12-Core Processor
Memory: 22.88 GB / 31.92 GB
Binaries:
Node: 20.11.1 - C:\Program Files\nodejs\node.EXE
npm: 9.7.1 - C:\Program Files\nodejs\npm.CMD
pnpm: 9.14.2 - ~\AppData\Local\pnpm\pnpm.CMD
Browsers:
Chrome: 131.0.6778.86
Edge: Chromium (127.0.2651.74)
Internet Explorer: 11.0.19041.4355
npmPackages:
svelte: ^5.2.1 => 5.2.1Severity
annoyance