Skip to content

Commit 72205bd

Browse files
marcin-kordas-hocclaudesequba
authored
docs(api): fix getAllSheetsSerialized/getRangeSerialized JSDoc for number cells (HF-219) (#1693)
Fixes the `getAllSheetsSerialized` / `getRangeSerialized` JSDoc examples that wrongly implied numeric strings are serialized as numbers — serialization round-trips, preserving the exact input type. Mirrors #1654. Documentation-only (a single source file changed), so no CHANGELOG entry per the docs-only convention. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Comment and example changes only; no runtime or serialization logic modified. > > **Overview** > **Documentation-only** updates to JSDoc for `getAllSheetsSerialized` and `getRangeSerialized` in `HyperFormula.ts`. > > The docs now state that **non-formula cells keep the exact `RawCellContent` type they were set with** (string `'1'` vs number `1`), and the embedded examples were corrected so numeric literals are numbers in sample input/output instead of implying string digits are coerced to numbers on serialize. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 691b8b1. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com> Co-authored-by: Kuba Sekowski <jakub.sekowski@handsontable.com>
1 parent d4195b5 commit 72205bd

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

src/HyperFormula.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -995,15 +995,19 @@ export class HyperFormula implements TypedEmitter {
995995
/**
996996
* Returns formulas or values of all sheets in a form of an object which property keys are strings and values are 2D arrays of [[RawCellContent]].
997997
*
998+
* Each non-formula cell is serialized to the exact value it was set with, preserving its type.
999+
* For example, a cell set with the string `'1'` is serialized as the string `'1'`, while a cell set with the number `1` is serialized as the number `1`.
1000+
*
9981001
* @throws [[EvaluationSuspendedError]] when the evaluation is suspended
9991002
*
10001003
* @example
10011004
* ```js
10021005
* const hfInstance = HyperFormula.buildFromArray([
1003-
* ['1', '2', '=A1+10'],
1006+
* ['1', 2, '=A1+10'],
10041007
* ]);
10051008
*
1006-
* // should return all sheets serialized content: { Sheet1: [ [ 1, 2, '=A1+10' ] ] }
1009+
* // should return all sheets serialized content: { Sheet1: [ [ '1', 2, '=A1+10' ] ] }
1010+
* // note: the string '1' stays a string and the number 2 stays a number
10071011
* const allSheetsSerialized = hfInstance.getAllSheetsSerialized();
10081012
* ```
10091013
*
@@ -2494,6 +2498,9 @@ export class HyperFormula implements TypedEmitter {
24942498
/**
24952499
* Returns serialized cells in given range.
24962500
*
2501+
* Each non-formula cell is serialized to the exact value it was set with, preserving its type
2502+
* (e.g., a cell set with the string `'2'` is serialized as the string `'2'`, while a cell set with the number `2` is serialized as the number `2`).
2503+
*
24972504
* @param {SimpleCellRange} source - rectangular range
24982505
*
24992506
* @throws [[ExpectedValueOfTypeError]] if source is of wrong type
@@ -2503,9 +2510,9 @@ export class HyperFormula implements TypedEmitter {
25032510
* @example
25042511
* ```js
25052512
* const hfInstance = HyperFormula.buildFromArray([
2506-
* ['=SUM(1, 2)', '2', '10'],
2507-
* ['5', '6', '7'],
2508-
* ['40', '30', '20'],
2513+
* ['=SUM(1, 2)', 2, 10],
2514+
* [5, 6, 7],
2515+
* [40, 30, 20],
25092516
* ]);
25102517
*
25112518
* // should return serialized cell content for the given range:

0 commit comments

Comments
 (0)