MCPcopy
hub / github.com/monkeytypegame/monkeytype / fromQueries

Function fromQueries

frontend/src/ts/components/common/AsyncContent.tsx:219–232  ·  view source on GitHub ↗
(queries: {
  [K in keyof T]: UseQueryResult<T[K]>;
})

Source from the content-addressed store, hash-verified

217}
218
219function fromQueries<T extends Record<string, unknown>>(queries: {
220 [K in keyof T]: UseQueryResult<T[K]>;
221}): AsyncMap<T> {
222 return typedKeys(queries).reduce((acc, key) => {
223 const q = queries[key];
224 acc[key] = {
225 value: () => q.data,
226 isLoading: () => q.isLoading,
227 isError: () => q.isError,
228 error: () => q.error,
229 };
230 return acc;
231 }, {} as AsyncMap<T>);
232}
233
234function fromCollections<T extends Record<string, unknown>>(collections: {
235 [K in keyof T]: Collection<T[K]>;

Callers 1

AsyncContentFunction · 0.85

Calls 1

typedKeysFunction · 0.90

Tested by

no test coverage detected