Skip to content

Commit 6b9a1f0

Browse files
committed
fix: better render type
1 parent 6655f2c commit 6b9a1f0

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

.changeset/funny-cooks-clean.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: better `render` type

packages/svelte/src/internal/server/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,10 @@ export function element(payload, tag, attributes_fn, children_fn) {
9696
export let on_destroy = [];
9797

9898
/**
99-
* @param {typeof import('svelte').SvelteComponent} component
100-
* @param {{ props: Record<string, any>; context?: Map<any, any> }} options
99+
* @template {Record<string, any>} TProps
100+
*
101+
* @param {import('svelte').Component<TProps> | import('svelte').ComponentType<import('svelte').SvelteComponent<TProps>>} component
102+
* @param {{ props: Omit<TProps, '$$slots' | '$$events'>; context?: Map<any, any> }} options
101103
* @returns {import('#server').RenderOutput}
102104
*/
103105
export function render(component, options) {

packages/svelte/types/index.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2108,9 +2108,9 @@ declare module 'svelte/reactivity' {
21082108
}
21092109

21102110
declare module 'svelte/server' {
2111-
export function render(component: typeof import('svelte').SvelteComponent, options: {
2112-
props: Record<string, any>;
2113-
context?: Map<any, any>;
2111+
export function render<TProps extends Record<string, any>>(component: import("svelte").Component<TProps, any, string> | import("svelte").ComponentType<import("svelte").SvelteComponent<TProps, any, any>>, options: {
2112+
props: Omit<TProps, "$$slots" | "$$events">;
2113+
context?: Map<any, any> | undefined;
21142114
}): RenderOutput;
21152115
interface RenderOutput {
21162116
/** HTML that goes into the `<head>` */

0 commit comments

Comments
 (0)