mirror of https://github.com/sveltejs/svelte
parent
0024e1ed3e
commit
8c7ad3c5a3
@ -0,0 +1,14 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"code": "state_invalid_placement",
|
||||||
|
"message": "`$state(...)` can only be used as a variable declaration initializer, a class field declaration, or the first assignment to a class field at the top level of the constructor.",
|
||||||
|
"start": {
|
||||||
|
"line": 5,
|
||||||
|
"column": 16
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 5,
|
||||||
|
"column": 25
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
@ -0,0 +1,7 @@
|
|||||||
|
const count = 'count';
|
||||||
|
|
||||||
|
export class Counter {
|
||||||
|
constructor() {
|
||||||
|
this[count] = $state(0);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue