Repository navigation
Commit 4826b9e
committed
refactor(store): improve store types
store.ts:
Added bigint and symbol to `NotWrappable`.
Simplified `DeepReadonly<T>`.
`Store<T>` is now an alias for `DeepReadonly<T>`.
Refactored `Part`, `Next`, and `SetStoreFunction` to improve their performance.
Changed `NullableNext` to `Next`, and `Next` to `WrappableNext`. `WrappableNext` excludes all non-wrappable types instead of just non-nullable types, so `{a: number | {b: number}}` now allows `setStore("a", "b", 1)`.
Omitted irrelevant overloads for `SetStoreFunction<T>` i.e. a store of `{a: 1}` now only has two overloads: just a setter, and a key then setter.
store.spec.ts
Added a few test cases for store types.
modifiers.ts
Improved types of `reconcile` and `produce`; the latter now correctly infers types.
index.ts
Removed the `Readonly` export. Added `WrappableNext`.
fixes solidjs#7321 parent c9307f0 commit 4826b9e
4 files changed
Lines changed: 319 additions & 177 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
| 1 | + | |
11 | 2 | | |
12 | 3 | | |
13 | 4 | | |
| |||
113 | 104 | | |
114 | 105 | | |
115 | 106 | | |
116 | | - | |
| 107 | + | |
117 | 108 | | |
118 | | - | |
119 | | - | |
120 | | - | |
| 109 | + | |
121 | 110 | | |
122 | 111 | | |
123 | | - | |
124 | | - | |
125 | | - | |
| 112 | + | |
| 113 | + | |
126 | 114 | | |
127 | 115 | | |
128 | 116 | | |
| |||
147 | 135 | | |
148 | 136 | | |
149 | 137 | | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
| 138 | + | |
| 139 | + | |
157 | 140 | | |
158 | 141 | | |
159 | 142 | | |
| |||
0 commit comments