lib0 1.0.0-rc.31 → 1.0.0-rc.32

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.
@@ -1274,9 +1274,20 @@ export type DeltaConfigGetRecursiveAttrs<Conf_1 extends DeltaConf> = Conf_1 exte
1274
1274
  recursiveAttrs: true;
1275
1275
  } ? true : false;
1276
1276
  /**
1277
- * Transform Delta(Builder) to a normal delta.
1278
- */
1279
- export type _SanifyDelta<V> = V extends never ? never : (import("../ts.js").TypeIsAny<V, any, V extends Delta<infer Conf_1> ? Delta<Conf_1> : V>);
1277
+ * Transform Delta(Builder) to a normal delta: a `DeltaBuilder<Conf>` becomes `Delta<Conf>`, anything
1278
+ * else passes through.
1279
+ *
1280
+ * Infers the conf from `DeltaBuilder` on purpose, not from `Delta<infer Conf>`. lib0's own source
1281
+ * check never had a problem with the latter, but a consumer type-checks the emitted declaration
1282
+ * files, and there matching a builder against `Delta<infer Conf>` is structural: TypeScript walks
1283
+ * `Delta`'s members and recurses through {@link DeltaConfGetChildren}'s recursive branch until its
1284
+ * instantiation-depth limit, so every nested condensed builder (for example
1285
+ * `create().insert([create('c', {}, [create('p', {}, 'x')])])`) failed with TS2589 in
1286
+ * y-prosemirror and yjs. The structural walk also leaked the grandchild conf into the child
1287
+ * union; inferring from the builder keeps the nesting exact. dist-check/consumer.js pins both
1288
+ * against dist.
1289
+ */
1290
+ export type _SanifyDelta<V> = V extends never ? never : (import("../ts.js").TypeIsAny<V, any, V extends DeltaBuilder<infer Conf_1, any> ? Delta<Conf_1> : V>);
1280
1291
  export type PrettifyDeltaConf<Conf_1 extends DeltaConf> = import("../ts.js").Prettify<{ [K in keyof Conf_1]: K extends "attrs" ? import("../ts.js").Prettify<{ [KA in keyof Conf_1[K]]: _SanifyDelta<Conf_1[K][KA]>; }, 1> : (K extends "children" ? _SanifyDelta<Conf_1[K]> : Conf_1[K]); }, 1>;
1281
1292
  export type DeltaConfOverwrite<D1 extends DeltaConf, D2> = (import("../ts.js").TypeIsAny<D1, any, PrettifyDeltaConf<{ [K in (keyof D1 | keyof D2)]: K extends keyof D2 ? D2[K] : (K extends keyof D1 ? D1[K] : never); }>> & {}) extends infer DC extends DeltaConf ? DC : never;
1282
1293
  export type ReadableDeltaConf = {
@@ -1523,10 +1534,21 @@ declare class Mark {
1523
1534
  * @typedef {Conf extends {recursiveAttrs:true} ? true : false} DeltaConfigGetRecursiveAttrs
1524
1535
  */
1525
1536
  /**
1526
- * Transform Delta(Builder) to a normal delta.
1537
+ * Transform Delta(Builder) to a normal delta: a `DeltaBuilder<Conf>` becomes `Delta<Conf>`, anything
1538
+ * else passes through.
1539
+ *
1540
+ * Infers the conf from `DeltaBuilder` on purpose, not from `Delta<infer Conf>`. lib0's own source
1541
+ * check never had a problem with the latter, but a consumer type-checks the emitted declaration
1542
+ * files, and there matching a builder against `Delta<infer Conf>` is structural: TypeScript walks
1543
+ * `Delta`'s members and recurses through {@link DeltaConfGetChildren}'s recursive branch until its
1544
+ * instantiation-depth limit, so every nested condensed builder (for example
1545
+ * `create().insert([create('c', {}, [create('p', {}, 'x')])])`) failed with TS2589 in
1546
+ * y-prosemirror and yjs. The structural walk also leaked the grandchild conf into the child
1547
+ * union; inferring from the builder keeps the nesting exact. dist-check/consumer.js pins both
1548
+ * against dist.
1527
1549
  *
1528
1550
  * @template V
1529
- * @typedef {V extends never ? never : (import('../ts.js').TypeIsAny<V,any,V extends Delta<infer Conf> ? Delta<Conf> : V>)} _SanifyDelta
1551
+ * @typedef {V extends never ? never : (import('../ts.js').TypeIsAny<V,any,V extends DeltaBuilder<infer Conf, any> ? Delta<Conf> : V>)} _SanifyDelta
1530
1552
  */
1531
1553
  /**
1532
1554
  * @template {DeltaConf} Conf
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lib0",
3
- "version": "1.0.0-rc.31",
3
+ "version": "1.0.0-rc.32",
4
4
  "description": "isomorphic utility functions",
5
5
  "sideEffects": false,
6
6
  "type": "module",
@@ -1360,10 +1360,21 @@ export const createMark = (key, id, assoc, attrs, transient) => new Mark(key, id
1360
1360
  */
1361
1361
 
1362
1362
  /**
1363
- * Transform Delta(Builder) to a normal delta.
1363
+ * Transform Delta(Builder) to a normal delta: a `DeltaBuilder<Conf>` becomes `Delta<Conf>`, anything
1364
+ * else passes through.
1365
+ *
1366
+ * Infers the conf from `DeltaBuilder` on purpose, not from `Delta<infer Conf>`. lib0's own source
1367
+ * check never had a problem with the latter, but a consumer type-checks the emitted declaration
1368
+ * files, and there matching a builder against `Delta<infer Conf>` is structural: TypeScript walks
1369
+ * `Delta`'s members and recurses through {@link DeltaConfGetChildren}'s recursive branch until its
1370
+ * instantiation-depth limit, so every nested condensed builder (for example
1371
+ * `create().insert([create('c', {}, [create('p', {}, 'x')])])`) failed with TS2589 in
1372
+ * y-prosemirror and yjs. The structural walk also leaked the grandchild conf into the child
1373
+ * union; inferring from the builder keeps the nesting exact. dist-check/consumer.js pins both
1374
+ * against dist.
1364
1375
  *
1365
1376
  * @template V
1366
- * @typedef {V extends never ? never : (import('../ts.js').TypeIsAny<V,any,V extends Delta<infer Conf> ? Delta<Conf> : V>)} _SanifyDelta
1377
+ * @typedef {V extends never ? never : (import('../ts.js').TypeIsAny<V,any,V extends DeltaBuilder<infer Conf, any> ? Delta<Conf> : V>)} _SanifyDelta
1367
1378
  */
1368
1379
 
1369
1380
  /**