From: Ardis Lu Date: Sun, 25 May 2025 02:59:56 +0000 (-0700) Subject: Fix typechecking for `parsePathLike` X-Git-Tag: v0.1.0~19 X-Git-Url: https://git.ardis.lu/?a=commitdiff_plain;h=f8df4ebfc6b8fd92d6067cedad5ce6036c162d29;p=csvio Fix typechecking for `parsePathLike` `PathLike` only includes Node.js's `Buffer` type, need to explicitly add the web API `TypedArray` (e.g., `Uint8Array`). --- diff --git a/src/core.js b/src/core.js index 4756db7..6719cf3 100644 --- a/src/core.js +++ b/src/core.js @@ -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. */ diff --git a/test/core.test.js b/test/core.test.js index 94f5e8f..0376d23 100644 --- a/test/core.test.js +++ b/test/core.test.js @@ -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 {