@zikeji/hypixel
Version:
With IntelliSense support & test coverage, this is an unopinionated async/await API wrapper for Hypixel's Public API. It is developed in TypeScript complete with documentation, typed interfaces for all API responses, built-in rate-limit handling, flexible
23 lines (22 loc) • 840 B
TypeScript
import { DefaultMeta } from "../types/DefaultMeta";
/**
* Generic intersection type for result arrays to include metadata as a non-enumerable property.
* @example
* ```typescript
* const result = await client.skyblock.news();
* console.log(result);
* // (7) [{…}, {…}, {…}, {…}, {…}, {…}, {…}]
* console.log(result.meta)
* // {success: true}
* ```
*/
export type ResultArray<T extends Record<string, unknown>, K extends keyof T> = T[K] & {
meta: Omit<T, K> & DefaultMeta;
};
/** @hidden */
export declare function getResultArray<T extends Record<string, unknown>, K extends keyof T>(response: T & DefaultMeta, key: K): ResultArray<T, K>;
export type FlatResultArray<T> = T & {
meta: DefaultMeta;
};
/** @hidden */
export declare function getFlatResultArray<T>(response: T & DefaultMeta): FlatResultArray<T>;