diff --git a/.changeset/silly-keys-cheer.md b/.changeset/silly-keys-cheer.md new file mode 100644 index 00000000000..b1f1e75198d --- /dev/null +++ b/.changeset/silly-keys-cheer.md @@ -0,0 +1,8 @@ +--- +"@effect/platform-browser": patch +"@effect/platform-node": patch +"@effect/experimental": patch +"effect": patch +--- + +Support building under TypeScript 5.9 diff --git a/packages/effect/test/Match.test.ts b/packages/effect/test/Match.test.ts index e90730f5369..85d0565899f 100644 --- a/packages/effect/test/Match.test.ts +++ b/packages/effect/test/Match.test.ts @@ -578,11 +578,11 @@ describe("Match", () => { const match = pipe( M.type(), M.when(M.instanceOf(Uint8Array), (_) => { - assertType()(_) satisfies true + assertType>()(_) satisfies true return "uint8" }), M.when(M.instanceOf(Uint16Array), (_) => { - assertType()(_) satisfies true + assertType>()(_) satisfies true return "uint16" }), M.orElse((_) => { diff --git a/packages/experimental/src/EventJournal.ts b/packages/experimental/src/EventJournal.ts index 4126ff20e49..616c09e32c7 100644 --- a/packages/experimental/src/EventJournal.ts +++ b/packages/experimental/src/EventJournal.ts @@ -431,7 +431,7 @@ export const makeIndexedDb = (options?: { if (state.done) return const remoteEntry = state.value const entry = remoteEntry.entry - entries.get(entry.id).onsuccess = (event) => { + entries.get(entry.id as Uint8Array).onsuccess = (event) => { if ((event.target as any).result) { remotes.put({ remoteId: options.remoteId, @@ -516,7 +516,7 @@ export const makeIndexedDb = (options?: { const remotesStore = tx.objectStore("remotes") const remoteEntryIdStore = tx.objectStore("remoteEntryId") - remoteEntryIdStore.get(remoteId).onsuccess = (event) => { + remoteEntryIdStore.get(remoteId as Uint8Array).onsuccess = (event) => { const startEntryId = (event.target as any).result?.entryId const entryCursor = entriesStore.index("id").openCursor( startEntryId ? IDBKeyRange.lowerBound(startEntryId, true) : null, @@ -526,7 +526,9 @@ export const makeIndexedDb = (options?: { const cursor = entryCursor.result if (!cursor) return const entry = decodeEntryIdb(cursor.value) - remotesStore.get([remoteId, entry.id]).onsuccess = (event) => { + remotesStore.get([remoteId as Uint8Array, entry.id as Uint8Array]).onsuccess = ( + event + ) => { if (!(event.target as any).result) entries.push(entry) cursor.continue() } diff --git a/packages/experimental/src/EventLogEncryption.ts b/packages/experimental/src/EventLogEncryption.ts index d098c228eaf..d0188cc6abc 100644 --- a/packages/experimental/src/EventLogEncryption.ts +++ b/packages/experimental/src/EventLogEncryption.ts @@ -73,7 +73,7 @@ export const makeEncryptionSubtle = (crypto: Crypto): Effect.Effect crypto.subtle.importKey( "raw", - Redacted.value(identity.privateKey), + Redacted.value(identity.privateKey) as Uint8Array, "AES-GCM", true, ["encrypt", "decrypt"] @@ -93,7 +93,9 @@ export const makeEncryptionSubtle = (crypto: Crypto): Effect.Effect Promise.all( - data.map((entry) => crypto.subtle.encrypt({ name: "AES-GCM", iv, tagLength: 128 }, key, entry)) + data.map((entry) => + crypto.subtle.encrypt({ name: "AES-GCM", iv, tagLength: 128 }, key, entry as Uint8Array) + ) ) ) return { @@ -107,9 +109,9 @@ export const makeEncryptionSubtle = (crypto: Crypto): Effect.Effect Promise.all(entries.map((data) => crypto.subtle.decrypt( - { name: "AES-GCM", iv: data.iv, tagLength: 128 }, + { name: "AES-GCM", iv: data.iv as Uint8Array, tagLength: 128 }, key, - data.encryptedEntry + data.encryptedEntry as Uint8Array ) )) )).map((buffer) => new Uint8Array(buffer)) @@ -117,12 +119,12 @@ export const makeEncryptionSubtle = (crypto: Crypto): Effect.Effect new RemoteEntry({ remoteSequence: entries[i].sequence, entry })) }), sha256: (data) => - Effect.promise(() => crypto.subtle.digest("SHA-256", data)).pipe( + Effect.promise(() => crypto.subtle.digest("SHA-256", data as Uint8Array)).pipe( Effect.map((hash) => new Uint8Array(hash)) ), sha256String: (data) => Effect.map( - Effect.promise(() => crypto.subtle.digest("SHA-256", data)), + Effect.promise(() => crypto.subtle.digest("SHA-256", data as Uint8Array)), (hash) => { const hashArray = Array.from(new Uint8Array(hash)) const hashHex = hashArray diff --git a/packages/platform-browser/src/internal/httpClient.ts b/packages/platform-browser/src/internal/httpClient.ts index 74139107690..9f3ced8e9d1 100644 --- a/packages/platform-browser/src/internal/httpClient.ts +++ b/packages/platform-browser/src/internal/httpClient.ts @@ -91,7 +91,7 @@ const sendBody = ( case "Raw": return Effect.sync(() => xhr.send(body.body as any)) case "Uint8Array": - return Effect.sync(() => xhr.send(body.body)) + return Effect.sync(() => xhr.send(body.body as Uint8Array)) case "FormData": return Effect.sync(() => xhr.send(body.formData)) case "Stream": @@ -274,7 +274,7 @@ export abstract class IncomingMessageImpl extends Inspectable.Class }).pipe( Effect.map((response) => { if (typeof response === "string") { - return encoder.encode(response).buffer + return encoder.encode(response).buffer as ArrayBuffer } return response }), diff --git a/packages/platform-node/src/internal/httpIncomingMessage.ts b/packages/platform-node/src/internal/httpIncomingMessage.ts index e89a78032aa..4876511649a 100644 --- a/packages/platform-node/src/internal/httpIncomingMessage.ts +++ b/packages/platform-node/src/internal/httpIncomingMessage.ts @@ -87,7 +87,7 @@ export abstract class HttpIncomingMessageImpl extends Inspectable.Class NodeStream.toUint8Array(() => this.source, { onFailure: this.onError, maxBytes: Option.getOrUndefined(maxBodySize) - }) + }).pipe(Effect.map((_) => _.buffer as ArrayBuffer)) ) } }