-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Closed
Labels
runtimeChanges relating to runtime APIsChanges relating to runtime APIs
Description
Describe the bug
An action type should be available to developers. One is available if you stay within a *.svelte
file, but isn't present outside of it.
Reproduction
Define an action in your svelte file:
function onResize(
node: HTMLDivElement,
callback: (entry: DOMRectReadOnly) => void,
): SvelteActionReturnType {
// ...
}
and the types work.
Move the action outside to its own module, and you no longer have any types you can import to ensure action type.
Maybe something like this would work:
type SvelteActionReturnType<P> = {
update?: (newParams: P) => void;
destroy?: () => void;
} | void;
type SvelteActionType<P> = (
node: Element,
params: P,
) => SvelteActionReturnType<P>
Logs
No response
System Info
System:
OS: Linux 5.4 Ubuntu 20.04.2 LTS (Focal Fossa)
CPU: (24) x64 AMD Ryzen 9 5900X 12-Core Processor
Memory: 14.89 GB / 24.99 GB
Container: Yes
Shell: 5.8 - /bin/zsh
Binaries:
Node: 16.2.0 - ~/.asdf/installs/nodejs/16.2.0/bin/node
npm: 7.13.0 - ~/.asdf/installs/nodejs/16.2.0/bin/npm
npmPackages:
svelte: ^3.38.2 => 3.38.2
vite: ^2.3.7 => 2.3.7
Severity
annoyance
PuruVJ, Ocupe, chanced, tylerbrostrom, asyarb and 6 morePuruVJ and asyarb
Metadata
Metadata
Assignees
Labels
runtimeChanges relating to runtime APIsChanges relating to runtime APIs