UNPKG

stable-ts-type

Version:

Obtain the most stable type code of 'typescript' through multiple network requests

39 lines (38 loc) 1.26 kB
import EventEmitter from 'eventemitter2'; import type { TypeOpts } from './type-opts'; import { Input } from './input'; export interface GenerateOpts { topTypeName?: string; quickTypeOpts?: TypeOpts; requestInterval?: number; requireMockSort?: 'random' | 'regular'; on?: (event: `${GenerateEvent}`, codeOrError: string | Error) => void; } declare enum GenerateEvent { CHUNK_DONE_EVENT = "CHUNK_DONE", DONE_EVENT = "DONE", ERROR_EVENT = "ERROR" } export declare class Generator { static CHUNK_DONE_EVENT: GenerateEvent; static DONE_EVENT: GenerateEvent; static ERROR_EVENT: GenerateEvent; private opts; private jsonExamples; private requestInputs; eventEmitter: EventEmitter; private stopped; private fetch; private fetchCancel; private code; private jsonList; constructor(input: Input | Input[], opts?: GenerateOpts); private onGenerateChunk; generate(): Promise<void>; stop(): void; private static getEasyInputs; } export declare const simpleGenerate: (input: Input | Input[], opts?: Omit<GenerateOpts, 'on'>) => Promise<string>; /** @deprecated */ export declare const generate: (input: Input | Input[], opts?: GenerateOpts) => Promise<string>; export {};