docs: note TS caveat about module exports (#13842)

closes #13554
pull/13846/head
Simon H 11 months ago committed by GitHub
parent af4d105cd3
commit 594e3ab311
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -50,6 +50,8 @@ A `<script>` tag with a `module` attribute runs once when the module first evalu
You can `export` bindings from this block, and they will become exports of the compiled module. You cannot `export default`, since the default export is the component itself.
> [!NOTE] If you are using TypeScript and import such exports from a `module` block into a `.ts` file, make sure to have your editor setup so that TypeScript knows about them. This is the case for our VS Code extension and the IntelliJ plugin, in other cases you might need to setup our [TypeScript editor plugin](https://www.npmjs.com/package/typescript-svelte-plugin).
> [!LEGACY]
> In Svelte 4, this script tag was created using `<script context="module">`

Loading…
Cancel
Save