]> git.ardis.lu - csvio/commitdiff
Re-export all types in `index.js`
authorArdis Lu <ardisglu@gmail.com>
Fri, 11 Jul 2025 04:49:00 +0000 (21:49 -0700)
committerArdis Lu <ardisglu@gmail.com>
Fri, 11 Jul 2025 04:49:00 +0000 (21:49 -0700)
Currently, the types are accessible internally in the library and within `index.js`, but NOT accessible from consumers importing from the `index.js` file. A re-export is required to make the types accessible to end-users.

Additionally, the JSDoc import will only work for types declared at the module scope, so `CSVWriterStatus` was moved to the outer scope.

src/core.js
src/index.js

index 95948997eb17eddcfccc024303cad197af79fabc..7d982915fb279ee451e2d29f7a22c1dd9984966e 100644 (file)
@@ -474,6 +474,16 @@ export class CSVTransformer extends TransformStream {
   }
 }
 
+/**
+ * @typedef CSVWriterStatus The current status of the CSVWriter.
+ * @property {string} name The name of the output CSV file that this writer is writing to.
+ * @property {number} elapsed The number of milliseconds that have elapsed between this writer's creation and the output CSV file
+ * handle closing, or until now if the writer is still writing. Measured using `performance.now()`.
+ * @property {number} rows The estimated number of CSV rows that have been written. If the data passed to the writer is
+ * a string, the string is counted as one CSV row (i.e., raw string data is NOT parsed again). Includes the header row (first row).
+ * @property {boolean} done If `true`, the writer is finished writing to the output CSV file and the file handle is closed.
+ */
+
 /**
  * Write a streamed CSV file to disk.
  * 
@@ -532,16 +542,6 @@ export class CSVWriter extends WritableStream {
     this.#status = status;
   }
 
-  /**
-   * @typedef CSVWriterStatus The current status of the CSVWriter.
-   * @property {string} name The name of the output CSV file that this writer is writing to.
-   * @property {number} elapsed The number of milliseconds that have elapsed between this writer's creation and the output CSV file
-   * handle closing, or until now if the writer is still writing. Measured using `performance.now()`.
-   * @property {number} rows The estimated number of CSV rows that have been written. If the data passed to the writer is
-   * a string, the string is counted as one CSV row (i.e., raw string data is NOT parsed again). Includes the header row (first row).
-   * @property {boolean} done If `true`, the writer is finished writing to the output CSV file and the file handle is closed.
-   */
-
   /** @type {CSVWriterStatus} */
   get status() {
     if (!this.#status.done) {
index 0e82f90a4532b79dfa6a52e321a09a3b9fae4185..98edabd6fbd8503f5a634d59e87398a6790b4380 100644 (file)
@@ -1,3 +1,15 @@
 export { CSVReader, CSVTransformer, CSVWriter } from './core.js';
 export { CSVNormalizer, CSVDenormalizer } from './normalization.js';
 export { ErrorStrategies } from './errorStrategies.js';
+
+/** @typedef {import('./core.js').CSVReaderOptions} CSVReaderOptions */
+/** @typedef {import('./core.js').TransformationOutput} TransformationOutput */
+/** @typedef {import('./core.js').CSVTransformerOptions} CSVTransformerOptions */
+/** @typedef {import('./core.js').CSVTransformerOptionsRaw} CSVTransformerOptionsRaw */
+/** @typedef {import('./core.js').CSVTransformerOptionsBatch} CSVTransformerOptionsBatch */
+/** @typedef {import('./core.js').CSVWriterStatus} CSVWriterStatus */
+/** @typedef {import('./normalization.js').CSVNormalizerHeader} CSVNormalizerHeader */
+/** @typedef {import('./normalization.js').CSVNormalizerOptions} CSVNormalizerOptions */
+/** @typedef {import('./normalization.js').CSVNormalizerRow} CSVNormalizerRow */
+/** @typedef {import('./errorStrategies.js').RetryOptions} RetryOptions */
+/** @typedef {import('./errorStrategies.js').BackoffOptions} BackoffOptions */
This page took 0.047691 seconds and 4 git commands to generate.