js-slang
Version:
Javascript-based implementations of Source, written in Typescript
18 lines (17 loc) • 703 B
TypeScript
import { RuntimeSourceError } from '../errors/runtimeSourceError';
export declare class PromiseTimeoutError extends RuntimeSourceError {
}
export declare const timeoutPromise: <T>(promise: Promise<T>, timeout: number) => Promise<T>;
/**
* Run the mapping function over the items, filtering out any items that
* that the mapping function returned `undefined` for
*/
export declare function mapAndFilter<T, U>(items: T[], mapper: (input: T) => U | undefined): U[];
/**
* Type safe `Object.keys`
*/
export declare function objectKeys<T extends string | number | symbol>(obj: Record<T, any>): T[];
/**
* Type safe `Object.values`
*/
export declare function objectValues<T>(obj: Record<any, T>): T[];