Skip to content

Commit

Permalink
chore(process): ensure explicit array buffer casting in workerRequest
Browse files Browse the repository at this point in the history
Updated the type casting in the `workerRequest` function to explicitly cast `parameter.buffer` as `ArrayBuffer` when pushing to the transfer list. This change addresses type-checking improvements introduced in the latest TypeScript version, ensuring that the code complies with stricter type safety standards.
  • Loading branch information
shorwood committed Nov 28, 2024
1 parent 3601d7f commit d6095ec
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/process/workerRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ export async function workerRequest<T extends Function>(worker: Worker, name: st
// --- Push any transferable objects to the transfer list.
const transferList: TransferListItem[] = [port1]
for (const parameter of parameters) {
if (Buffer.isBuffer(parameter)) transferList.push(parameter.buffer)
if (isArrayBufferView(parameter)) transferList.push(parameter.buffer)
if (Buffer.isBuffer(parameter)) transferList.push(parameter.buffer as ArrayBuffer)
if (isArrayBufferView(parameter)) transferList.push(parameter.buffer as ArrayBuffer)
if (isArrayBuffer(parameter)) transferList.push(parameter)
}

Expand Down

0 comments on commit d6095ec

Please sign in to comment.