@typespec/http-server-js
Version:
TypeSpec HTTP server code generator for JavaScript
23 lines • 1.12 kB
TypeScript
import { Union, UnionVariant } from "@typespec/compiler";
import { JsContext, Module, PartialUnionSynthetic } from "../ctx.js";
/**
* Emit an inline union type. This will automatically import any referenced types that are part of the union.
*
* @param ctx - The emitter context.
* @param variants - The variants of the union.
* @param module - The module that this union is written into.
* @returns a string that can be used as a type reference
*/
export declare function emitUnionType(ctx: JsContext, variants: UnionVariant[], module: Module): string;
/**
* Emits a union type declaration as an alias.
*
* This is rare in TypeScript, but may occur in some niche cases where an alias is desirable.
*
* @param ctx - The emitter context.
* @param union - The union to emit.
* @param module - The module that this union declaration is written into.
* @param altName - An alternative name to use for the union if it is not named.
*/
export declare function emitUnion(ctx: JsContext, union: Union | PartialUnionSynthetic, module: Module, altName?: string): Iterable<string>;
//# sourceMappingURL=union.d.ts.map