From 7c8a7eaea8317c99f5b842f58abd0e6e4b9d177f Mon Sep 17 00:00:00 2001 From: Nicholas Berlette Date: Sat, 13 Dec 2025 07:23:39 +0000 Subject: [PATCH 1/3] fix: type errors from upstream breaking changes re TypedArray parameterization --- src/_internal.ts | 4 ++-- src/shim.ts | 2 ++ src/text_decoder.ts | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/_internal.ts b/src/_internal.ts index 1e4fc16..b9b4b19 100644 --- a/src/_internal.ts +++ b/src/_internal.ts @@ -186,7 +186,7 @@ export const TypedArray: TypedArrayConstructor = ObjectGetPrototypeOf( Uint8Array, ); export const TypedArrayPrototype: InstanceType = - TypedArray?.prototype!; + TypedArray?.prototype! as InstanceType; export const TypedArrayPrototypeGetToStringTag: { (target: unknown): TypedArrayToStringTag | undefined; } = uncurryGetter(TypedArrayPrototype, Symbol.toStringTag) as any; @@ -274,7 +274,7 @@ export function toUint8Array(input?: BufferSource | null): Uint8Array { return new Uint8Array(input); } catch (_) { try { - ArrayBufferPrototypeGetByteLength(input); + ArrayBufferPrototypeGetByteLength(input as ArrayBuffer); return new Uint8Array(input); } catch (_) { throw new TypeError( diff --git a/src/shim.ts b/src/shim.ts index bdc49ee..00dcdbd 100644 --- a/src/shim.ts +++ b/src/shim.ts @@ -39,6 +39,8 @@ * ``` * @module shim */ +import type {} from "./shim.d.ts"; + import { TextEncoder } from "./text_encoder.ts"; import { TextDecoder } from "./text_decoder.ts"; import { TextDecoderStream, TextEncoderStream } from "./streams.ts"; diff --git a/src/text_decoder.ts b/src/text_decoder.ts index 450e7d4..61c6f29 100644 --- a/src/text_decoder.ts +++ b/src/text_decoder.ts @@ -73,7 +73,7 @@ export class TextDecoder { readonly #fatal: boolean; readonly #ignoreBOM: boolean; - #buffer = new Uint8Array(0); + #buffer: Uint8Array = new Uint8Array(0); /** * Creates a new TextDecoder instance. From 31a6482dbe839674e1350c9c64cb10e339ed3d5f Mon Sep 17 00:00:00 2001 From: Nicholas Berlette Date: Sat, 13 Dec 2025 07:24:54 +0000 Subject: [PATCH 2/3] chore: bump version --- deno.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deno.json b/deno.json index a5bf462..85439c4 100644 --- a/deno.json +++ b/deno.json @@ -1,6 +1,6 @@ { "name": "@nick/utf8", - "version": "0.3.2", + "version": "0.4.0", "license": "MIT", "author": { "name": "Nicholas Berlette", From 38d1e243ba27b3b5ddf1b26459771ed489eb7fe6 Mon Sep 17 00:00:00 2001 From: Nicholas Berlette Date: Sat, 13 Dec 2025 07:30:11 +0000 Subject: [PATCH 3/3] fix: silence stupidly noisy no-import-prefix lint error --- deno.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/deno.json b/deno.json index 85439c4..ba31417 100644 --- a/deno.json +++ b/deno.json @@ -28,6 +28,11 @@ "fix": "deno fmt && deno lint --fix", "ok": "deno fmt --check && deno lint && deno run test" }, + "lint": { + "rules": { + "exclude": ["no-import-prefix"] + } + }, "lock": false, "nodeModulesDir": "auto", "publish": {