From c6c399ac71b23748aa49e603346d41d4f23d3348 Mon Sep 17 00:00:00 2001 From: Ardis Lu Date: Mon, 1 Jun 2026 22:43:55 -0700 Subject: [PATCH] Define `CSVWriterStatusInternal` type This type captures the previously undocumented `start` property that is used internally only. --- src/core.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/core.js b/src/core.js index 53bb1c3..4f68606 100644 --- a/src/core.js +++ b/src/core.js @@ -462,7 +462,15 @@ export class CSVTransformer extends TransformStream { * @property {boolean} done If `true`, the writer is finished writing to the output CSV file and the file handle is closed. */ -/** @type {WeakMap} Simulated private field for CSVWriter, required to simulate a dynamic superclass. */ +/** + * @typedef _CSVWriterStatusInternal + * @property {number} start High resolution timestamp of when this writer was created, represented as the time elapsed since + * `Performance.timeOrigin` in milliseconds. + * @typedef {CSVWriterStatus&_CSVWriterStatusInternal} CSVWriterStatusInternal The current status of the CSVWriter including + * private internal fields. + */ + +/** @type {WeakMap} Simulated private field for CSVWriter, required to simulate a dynamic superclass. */ const _status = new WeakMap(); /** @@ -486,6 +494,7 @@ export class CSVWriter { * @returns {CSVWriter&TransformStream,string>} */ constructor(path = null) { + /** @type {CSVWriterStatusInternal} */ const status = { name: null, start: performance.now(), @@ -554,7 +563,7 @@ export class CSVWriter { /** @type {CSVWriterStatus} */ get status() { - const status = _status.get(this); + const status = /** @type {CSVWriterStatusInternal} */(_status.get(this)); if (!status.done) { status.elapsed = performance.now() - status.start; } -- 2.47.3