You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug As per the docs when exporting something from a <script context="module">that something is available to import in javascript files.
<scriptcontext="module">
let totalComponents =0;// this allows an importer to do e.g.// `import Example, { alertTotal } from './Example.svelte'`exportfunctionalertTotal() {alert(totalComponents); }
</script>
<script>
totalComponents +=1;console.log(`total number of times this component has been created: ${totalComponents}`);
</script>
To Reproduce
However, when trying a similar example to the docs in typescript I get a similar error to this:
Module '"*.svelte"' has no exported member 'alertTotal'. Did you mean to use 'import alertTotal from "*.svelte"' instead?
Expected behavior
It's possible to import types, variables, functions, etc. from any module context in a component
Ideally both import and import type should be supported
System (please complete the following information):
OS: Linux
IDE: VSCode
Plugin/Package: Svelte for VS Code
The text was updated successfully, but these errors were encountered:
Describe the bug
As per the docs when exporting something from a
<script context="module">
that something is available to import in javascript files.To Reproduce
However, when trying a similar example to the docs in typescript I get a similar error to this:
Expected behavior
It's possible to import types, variables, functions, etc. from any module context in a component
Ideally both
import
andimport type
should be supportedSystem (please complete the following information):
The text was updated successfully, but these errors were encountered: