@loro-extended/change 5.2.0 → 5.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +21 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/functional-helpers.test.ts +125 -0
- package/src/shape.ts +21 -0
package/dist/index.d.ts
CHANGED
|
@@ -1195,6 +1195,27 @@ interface RecordContainerShape<NestedShape extends ContainerOrValueShape = Conta
|
|
|
1195
1195
|
interface AnyContainerShape extends Shape<unknown, unknown, undefined> {
|
|
1196
1196
|
readonly _type: "any";
|
|
1197
1197
|
}
|
|
1198
|
+
/**
|
|
1199
|
+
* Union of all container shape types.
|
|
1200
|
+
*
|
|
1201
|
+
* Each container shape has a `_mutable` type parameter that maps to the
|
|
1202
|
+
* corresponding TypedRef class (e.g., TextContainerShape → TextRef).
|
|
1203
|
+
* This enables deriving ref types from shapes:
|
|
1204
|
+
*
|
|
1205
|
+
* ```typescript
|
|
1206
|
+
* // Get the ref type for any container shape
|
|
1207
|
+
* type RefType = ContainerShape["_mutable"]
|
|
1208
|
+
*
|
|
1209
|
+
* // Exclude AnyContainerShape to get only typed refs
|
|
1210
|
+
* type AnyTypedRef = Exclude<ContainerShape, AnyContainerShape>["_mutable"]
|
|
1211
|
+
* ```
|
|
1212
|
+
*
|
|
1213
|
+
* This creates intentional parallel hierarchies:
|
|
1214
|
+
* - ContainerShape → defines what data looks like (schema)
|
|
1215
|
+
* - TypedRef (via _mutable) → defines how you interact with data
|
|
1216
|
+
* - loro() overloads → CRDT escape hatch (IDE DX)
|
|
1217
|
+
* - change() overloads → mutation boundaries (IDE DX)
|
|
1218
|
+
*/
|
|
1198
1219
|
type ContainerShape = AnyContainerShape | CounterContainerShape | ListContainerShape | MovableListContainerShape | RecordContainerShape | StructContainerShape | TextContainerShape | TreeContainerShape;
|
|
1199
1220
|
type ContainerType = ContainerShape["_type"];
|
|
1200
1221
|
interface StringValueShape<T extends string = string> extends Shape<T, T, T> {
|