TS/JS docs get lost when using $$restProps
Describe the bug
When using {...$$restProps}, type infos are getting lost when running svelte-kit package
To Reproduce repro to clone: https://github.com/mrtnbroder/svelte-lost-types
Expected behavior
Using $$restProps shouldn't mess up the types produced
When using $$restProps
import { SvelteComponentTyped } from "svelte";
declare const __propDef: {
props: {
[x: string]: any;
class?: string | null;
disabled?: boolean | null;
};
events: {
[evt: string]: CustomEvent<any>;
};
slots: {
default: {};
};
};
export declare type ButtonProps = typeof __propDef.props;
export declare type ButtonEvents = typeof __propDef.events;
export declare type ButtonSlots = typeof __propDef.slots;
export default class Button extends SvelteComponentTyped<ButtonProps, ButtonEvents, ButtonSlots> {
}
export {};
vs
not using $$restProps
import { SvelteComponentTyped } from "svelte";
declare const __propDef: {
props: {
/** CSS class for the element. */ class?: string | null;
/** Whether the button is disabled. */ disabled?: boolean | null;
};
events: {
[evt: string]: CustomEvent<any>;
};
slots: {
default: {};
};
};
export declare type ButtonProps = typeof __propDef.props;
export declare type ButtonEvents = typeof __propDef.events;
export declare type ButtonSlots = typeof __propDef.slots;
export default class Button extends SvelteComponentTyped<ButtonProps, ButtonEvents, ButtonSlots> {
}
export {};
To me this looks as expected. You are using $$restProps which means you support passing other properties than the ones explicitly defined on the component. So the type definitions need to reflect that by also having an index signature on the props definition. Is it this what you think is wrong or is it something else?
@dummdidumm I'm talking about the comments here -> ** CSS class for the element. *