-
-
Notifications
You must be signed in to change notification settings - Fork 223
Closed
Labels
FixedFixed in master branch. Pending production release.Fixed in master branch. Pending production release.bugSomething isn't workingSomething isn't working
Description
Describe the bug
If a component doesn't have a script tag or has nothing in a script tag, the generated type class doesn't extend from SvelteComponentTyped. This causes the vscode extension to complain "cannot be used as JSX component" (Screenshot below).
To Reproduce
Steps to reproduce the behavior:
I'm using svelte2tsx emitDts() to generate the types.
Given: Section.svelte
<section class="my-6">
<slot />
</section>Output:: Section.svelte.d.ts
/** @typedef {typeof __propDef.props} SectionProps */
/** @typedef {typeof __propDef.events} SectionEvents */
/** @typedef {typeof __propDef.slots} SectionSlots */
export default class Section {
}
export type SectionProps = typeof __propDef.props;
export type SectionEvents = typeof __propDef.events;
export type SectionSlots = typeof __propDef.slots;
declare const __propDef: {
props: {};
events: {
[evt: string]: CustomEvent<any>;
};
slots: {
default: {};
};
};
export {};Expected behavior
/** @typedef {typeof __propDef.props} SectionProps */
/** @typedef {typeof __propDef.events} SectionEvents */
/** @typedef {typeof __propDef.slots} SectionSlots */
- export default class Section {
+ export default class Section extends SvelteComponentTyped<{
+ }, {
+ [evt: string]: CustomEvent<any>;
+ }, {
+ default: {};
+ }> {
}
export type SectionProps = typeof __propDef.props;
export type SectionEvents = typeof __propDef.events;
export type SectionSlots = typeof __propDef.slots;
+ import { SvelteComponentTyped } from "svelte";
declare const __propDef: {
props: {};
events: {
[evt: string]: CustomEvent<any>;
};
slots: {
default: {};
};
};
export {};System (please complete the following information):
- OS: Ubuntu 21.04
- IDE:VSCode
- Plugin/Package:
svelte2tsx
Additional context
I'm able to reproduce with local repo of language-tools. Trying to figure out why.
Metadata
Metadata
Assignees
Labels
FixedFixed in master branch. Pending production release.Fixed in master branch. Pending production release.bugSomething isn't workingSomething isn't working
