@typespec/http-server-js
Version:
TypeSpec HTTP server code generator for JavaScript
50 lines • 2.19 kB
TypeScript
import { Interface, Operation, Type, UnionVariant } from "@typespec/compiler";
import { JsContext, Module, PathCursor } from "../ctx.js";
/**
* Emit an interface declaration.
*
* @param ctx - The emitter context.
* @param iface - The interface to emit.
* @param module - The module that this interface is written into.
*/
export declare function emitInterface(ctx: JsContext, iface: Interface, module: Module): Iterable<string>;
/**
* Emit a list of operation signatures.
*
* @param ctx - The emitter context.
* @param operations - The operations to emit.
* @param module - The module that the operations are written into.
*/
export declare function emitOperationGroup(ctx: JsContext, operations: Iterable<Operation>, module: Module): Iterable<string>;
/**
* Emit a single operation signature.
*
* @param ctx - The emitter context.
* @param op - The operation to emit.
* @param module - The module that the operation is written into.
*/
export declare function emitOperation(ctx: JsContext, op: Operation, module: Module): Iterable<string>;
/**
* Emit a declaration for an options type including the optional parameters of an operation.
*
* @param ctx - The emitter context.
* @param operation - The operation to emit the options type for.
* @param module - The module that the options type is written into.
* @param optionsTypeName - The name of the options type.
*/
export declare function emitOptionsType(ctx: JsContext, operation: Operation, module: Module, optionsTypeName: string): void;
export interface SplitReturnTypeCommon {
typeReference: string;
target: Type | [PathCursor, string] | undefined;
}
export interface OrdinarySplitReturnType extends SplitReturnTypeCommon {
kind: "ordinary";
}
export interface UnionSplitReturnType extends SplitReturnTypeCommon {
kind: "union";
variants: UnionVariant[];
}
export type SplitReturnType = OrdinarySplitReturnType | UnionSplitReturnType;
export declare function isInfallible(split: SplitReturnType): boolean;
export declare function splitReturnType(ctx: JsContext, type: Type, module: Module, altBaseName: string): [SplitReturnType, SplitReturnType];
//# sourceMappingURL=interface.d.ts.map