Skip to content

feat: add $state.opaque rune #14639

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 14 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
lint
  • Loading branch information
trueadm committed Dec 9, 2024
commit 1070039ea22759795119d5279b8ec04ead0c7f26
4 changes: 3 additions & 1 deletion documentation/docs/98-reference/.generated/compile-errors.md
Original file line number Diff line number Diff line change
Expand Up @@ -751,9 +751,11 @@ Cannot export state from a module if it is reassigned. Either export a function
### state_invalid_opaque_declaration

```
`$state.opaque(...)` must be declared with an destructured array pattern (e.g. `let [state, invalidate] = $state.opaque(data);`)
`$state.opaque(...)` must be declared with an destructured array pattern and the state expression must be an identifier.
```

For example: `let [state, invalidate] = $state.opaque(data);`

### state_invalid_placement

```
Expand Down
4 changes: 3 additions & 1 deletion packages/svelte/messages/compile-errors/script.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,9 @@ It's possible to export a snippet from a `<script module>` block, but only if it

## state_invalid_opaque_declaration

> `$state.opaque(...)` must be declared with an destructured array pattern (e.g. `let [state, invalidate] = $state.opaque(data);`)
> `$state.opaque(...)` must be declared with an destructured array pattern and the state expression must be an identifier.

For example: `let [state, invalidate] = $state.opaque(data);`

## state_invalid_placement

Expand Down
4 changes: 2 additions & 2 deletions packages/svelte/src/compiler/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -433,12 +433,12 @@ export function state_invalid_export(node) {
}

/**
* `$state.opaque(...)` must be declared with an destructured array pattern (e.g. `let [state, invalidate] = $state.opaque(data);`)
* `$state.opaque(...)` must be declared with an destructured array pattern and the state expression must be an identifier.
* @param {null | number | NodeLike} node
* @returns {never}
*/
export function state_invalid_opaque_declaration(node) {
e(node, "state_invalid_opaque_declaration", "`$state.opaque(...)` must be declared with an destructured array pattern (e.g. `let [state, invalidate] = $state.opaque(data);`)");
e(node, "state_invalid_opaque_declaration", "`$state.opaque(...)` must be declared with an destructured array pattern and the state expression must be an identifier.");
}

/**
Expand Down
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy