MCPcopy Create free account
hub / github.com/modelcontextprotocol/typescript-sdk / toArrayAsync

Function toArrayAsync

src/shared/responseMessage.ts:51–58  ·  view source on GitHub ↗
(it: T)

Source from the content-addressed store, hash-verified

49export type AsyncGeneratorValue<T> = T extends AsyncGenerator<infer U> ? U : never;
50
51export async function toArrayAsync<T extends AsyncGenerator<unknown>>(it: T): Promise<AsyncGeneratorValue<T>[]> {
52 const arr: AsyncGeneratorValue<T>[] = [];
53 for await (const o of it) {
54 arr.push(o as AsyncGeneratorValue<T>);
55 }
56
57 return arr;
58}
59
60export async function takeResult<T extends Result, U extends AsyncGenerator<ResponseMessage<T>>>(it: U): Promise<T> {
61 for await (const o of it) {

Callers 2

protocol.test.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…