Something went wrong. Try again.
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243/** One piece of a streamed input: a string, or a UTF-8 `Uint8Array` decoded as a * stream (so a multi-byte sequence may split across chunks). */export type Chunk = string | Uint8Array;
export interface Options { /** `"erase"` (default): erasable syntax only, every offset preserved. `"downlevel"`: * also down-levels `enum`, instantiated `namespace`, parameter properties, `import =` * and `export =`; lines are preserved, columns only outside converted constructs. */ mode?: "erase" | "downlevel"; /** Receives `{start, end}` (UTF-16 units) for syntax `mode` cannot erase. Without it, * the first such construct throws (or, for a generator, throws from `next()`) an * `UnsupportedSyntaxError`. */ onError?: (error: { start: number; end: number }) => void;}
/** Transforms a whole string, asynchronously. */export function transform(src: string, opts?: Options): Promise<string>;/** Transforms a stream of chunks, asynchronously. Concatenating every yielded string * equals the string-input result for the same total input. */export function transform(src: Iterable<Chunk> | AsyncIterable<Chunk>, opts?: Options): AsyncGenerator<string>;
/** Transforms a whole string, synchronously. */export function transformSync(src: string, opts?: Options): string;/** Transforms a stream of chunks, synchronously. Concatenating every yielded string * equals the string-input result for the same total input. */export function transformSync(src: Iterable<Chunk>, opts?: Options): Generator<string>;
/** Lazily instantiates and returns the first pooled instance of the wasm engine for * `mode`, compiling it at most once per engine. Kept for tests/profiling. */export function engine(mode?: "erase" | "downlevel"): { memory: WebAssembly.Memory; [export_: string]: unknown;};
/** Thrown for syntax the mode cannot erase when no `onError` is given, like Node's * `ERR_UNSUPPORTED_TYPESCRIPT_SYNTAX`. */export class UnsupportedSyntaxError extends SyntaxError { code: "ERR_UNSUPPORTED_TYPESCRIPT_SYNTAX"; start: number; end: number; constructor(start: number, end: number);}