fix: preserve tuple type in `$state.snapshot` (#16864)

* fix: preserve tuple type in `$state.snapshot`

* Update .changeset/lucky-moles-enjoy.md

---------

Co-authored-by: Rich Harris <hello@rich-harris.dev>
pull/16877/head
Jungzl 2 days ago committed by GitHub
parent 499973454a
commit 949c026259
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,5 @@
---
'svelte': patch
---
fix: preserve tuple type in `$state.snapshot`

@ -85,6 +85,8 @@ declare namespace $state {
? NonReactive<T>
: T extends { toJSON(): infer R }
? R
: T extends readonly unknown[]
? { [K in keyof T]: Snapshot<T[K]> }
: T extends Array<infer U>
? Array<Snapshot<U>>
: T extends object

@ -3171,6 +3171,8 @@ declare namespace $state {
? NonReactive<T>
: T extends { toJSON(): infer R }
? R
: T extends readonly unknown[]
? { [K in keyof T]: Snapshot<T[K]> }
: T extends Array<infer U>
? Array<Snapshot<U>>
: T extends object

Loading…
Cancel
Save