-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Error when attemping to mutate an immutable tuple type
- Loading branch information
1 parent
86010a3
commit 88b9a10
Showing
2 changed files
with
21 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import type { uint64 } from '@algorandfoundation/algorand-typescript' | ||
|
||
function test(a: uint64) { | ||
const t1: [uint64, uint64, uint64] = [a, a, a] | ||
let t2 = { a, b: a, c: a } | ||
|
||
a *= 2 | ||
|
||
// @expect-error Expression is not a valid assignment target - object is immutable | ||
t1[0] = a | ||
|
||
// @expect-error Expression is not a valid assignment target - object is immutable | ||
t2.a = a | ||
|
||
t2 = { ...t2, a } | ||
} |