]> git.ardis.lu - csvio/commitdiff
Fix typechecking for `parsePathLike`
authorArdis Lu <ardisglu@gmail.com>
Sun, 25 May 2025 02:59:56 +0000 (19:59 -0700)
committerArdis Lu <ardisglu@gmail.com>
Sun, 25 May 2025 02:59:56 +0000 (19:59 -0700)
`PathLike` only includes Node.js's `Buffer` type, need to explicitly add the web API `TypedArray` (e.g., `Uint8Array`).

src/core.js
test/core.test.js

index 4756db73282621409d2f630ab4af292b05700c7a..6719cf3e78e33f8351d71280ea00479556591bee 100644 (file)
@@ -6,7 +6,7 @@ import { fileURLToPath } from 'node:url';
 /**
  * Parse and normalize a `PathLike` object into a string.
  * 
- * @param {PathLike} path A `string`, `Buffer`, or `URL` representing a path to a local file.
+ * @param {PathLike|ArrayBufferView} path A `string`, `Buffer`, or `URL` representing a path to a local file.
  * @returns {string} The normalized file path in string form.
  * @throws {TypeError} If `path` is not a `string`, `Buffer`, or `URL`, or it is a `URL` that is not using the `file` schema.
  */
index 94f5e8fa55857fa77e776b51761619531066d35e..0376d231232bddd3c41298b9d6814ff87e1b4337 100644 (file)
@@ -44,6 +44,7 @@ suite('parsePathLike', { concurrency: true }, () => {
   for (const { name, input, output, error } of vectors) {
     test(name, { concurrency: true }, () => {
       if (error !== undefined) {
+        // @ts-expect-error
         throws(() => parsePathLike(input), error);
       }
       else {
This page took 0.035188 seconds and 4 git commands to generate.