Skip to content

Commit

Permalink
Explain about context=module exports into Typescript
Browse files Browse the repository at this point in the history
Document the issue from sveltejs#5817
  • Loading branch information
curiousdannii authored Oct 10, 2024
1 parent 484588a commit 18a7536
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions documentation/docs/02-template-syntax/01-svelte-components.md
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,8 @@ You can `export` bindings from this block, and they will become exports of the c

You cannot `export default`, since the default export is the component itself.

> Note that if you are using TypeScript, exports from a `context="module"` block will not be exposed to TypeScript, and the type checker will complain about unknown members. If possible, it is preferable to export from TypeScript into Svelte, and only import Svelte components themselves into TypeScript.
> Variables defined in `module` scripts are not reactive — reassigning them will not trigger a rerender even though the variable itself will update. For values shared between multiple components, consider using a [store](/docs/svelte-store).
```svelte
Expand Down

0 comments on commit 18a7536

Please sign in to comment.