pull/13441/head
Simon Holthausen 2 years ago
parent 62be1cd4b2
commit 31c4930dfb

@ -7,7 +7,8 @@ import {
mount,
hydrate,
type Component,
type ComponentInternals
type ComponentInternals,
type ComponentExports
} from 'svelte';
import { render } from 'svelte/server';
@ -180,6 +181,16 @@ render(NewComponent, {
}
});
const newComponentExports: ComponentExports<typeof NewComponent> = {
anExport: '',
$$events_def: null as any,
$$prop_def: null as any,
$$slot_def: null as any,
$set: null as any,
$destroy: null as any,
$on: null as any
};
// --------------------------------------------------------------------------- interop
const AsLegacyComponent = asClassComponent(newComponent);
@ -337,6 +348,19 @@ render(functionComponent, {
}
});
const functionComponentExports: ComponentExports<typeof functionComponent> = {
foo: 'bar',
// @ts-expect-error
x: ''
};
type AdhocFunctionComponent = (a: unknown, b: { a: true }) => { foo: string };
const adhocFunctionComponentExport: ComponentExports<AdhocFunctionComponent> = {
foo: 'bar',
// @ts-expect-error
x: ''
};
// --------------------------------------------------------------------------- *.svelte components
// import from a nonexistent file to trigger the declare module '*.svelte' in ambient.d.ts

Loading…
Cancel
Save