From: Ardis Lu Date: Tue, 2 Jun 2026 05:43:55 +0000 (-0700) Subject: Define `CSVWriterStatusInternal` type X-Git-Tag: v0.1.11~6 X-Git-Url: https://git.ardis.lu/?a=commitdiff_plain;h=c6c399ac71b23748aa49e603346d41d4f23d3348;p=csvio Define `CSVWriterStatusInternal` type This type captures the previously undocumented `start` property that is used internally only. --- 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; }