]> git.ardis.lu - csvio/commitdiff
Define `CSVWriterStatusInternal` type
authorArdis Lu <ardisglu@gmail.com>
Tue, 2 Jun 2026 05:43:55 +0000 (22:43 -0700)
committerArdis Lu <ardisglu@gmail.com>
Tue, 2 Jun 2026 05:43:55 +0000 (22:43 -0700)
This type captures the previously undocumented `start` property that is used internally only.

src/core.js

index 53bb1c38fc79c9c5d8646fe2c0be414a47101512..4f6860626735821eb9fedfaa66d9f8f697ad724d 100644 (file)
@@ -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<CSVWriter, CSVWriterStatus>} 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<CSVWriter, CSVWriterStatusInternal>} 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<Array<string>,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;
     }
This page took 0.037157 seconds and 4 git commands to generate.