opaque-rune
Dominic Gannaway 9 months ago
parent 1070039ea2
commit 84a34aeff5

@ -170,7 +170,7 @@ 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 and the state expression must be an identifier.
> `$state.opaque(...)` must be declared with an destructured array pattern and the state expression and invalidation expression must be an identifier.
For example: `let [state, invalidate] = $state.opaque(data);`

@ -98,7 +98,8 @@ export function CallExpression(node, context) {
(parent.type !== 'VariableDeclarator' ||
parent.id.type !== 'ArrayPattern' ||
parent.id.elements.length !== 2 ||
parent.id.elements[0]?.type !== 'Identifier')
parent.id.elements[0]?.type !== 'Identifier' ||
parent.id.elements[1]?.type !== 'Identifier')
) {
e.state_invalid_opaque_declaration(node);
}

Loading…
Cancel
Save