From: Ardis Lu Date: Mon, 26 May 2025 05:39:02 +0000 (-0700) Subject: Refine types X-Git-Tag: v0.1.0~14 X-Git-Url: https://git.ardis.lu/?a=commitdiff_plain;h=884652f6ea49a0b3c3d323833c5c6744baa6a80b;p=csvio Refine types --- diff --git a/src/core.js b/src/core.js index 6719cf3..b193f40 100644 --- a/src/core.js +++ b/src/core.js @@ -2,6 +2,7 @@ import { mkdir, open } from 'node:fs/promises'; import { dirname, basename, normalize } from 'node:path'; import { fileURLToPath } from 'node:url'; /** @import { PathLike } from 'node:fs'; */ +/** @import { FileHandle } from 'node:fs/promises'; */ /** * Parse and normalize a `PathLike` object into a string. @@ -394,6 +395,7 @@ export class CSVWriter extends WritableStream { rows: 0, done: false }; + /** @type FileHandle */ let handle; super({ async start() { diff --git a/src/normalization.js b/src/normalization.js index a241eb1..135245f 100644 --- a/src/normalization.js +++ b/src/normalization.js @@ -1,5 +1,5 @@ // User locale's decimal separator -const DECIMAL_SEPARATOR = /** @type {Intl.NumberFormatPart!} */(Intl.NumberFormat().formatToParts(.1).find(p => p.type === 'decimal')).value; +const DECIMAL_SEPARATOR = Intl.NumberFormat().formatToParts(.1).find(p => p.type === 'decimal').value; /** * Convert a string to camelCase.