Skip to main content

generate_index

Function generate_index 

Source
fn generate_index(
    all_names: &[String],
    client_names: &[String],
    module_contents: &[(String, String)],
) -> String
Expand description

Generate index.ts with re-exports.

For service schemas: re-exports {Pascal}Client class. For data-only schemas: re-exports all exported symbols (standalone builders/parsers). Does not use export type * for service schemas since different services may share type names (e.g., ErrorInfo, StreamInfo) which causes TS2308 conflicts.

Data-only modules are barrel-exported with a plain export * from './name' UNLESS one of their exported names also appears in another data-only module — in that case every data-only module sharing the name switches to an explicit export { ... } list with the colliding names aliased as {PascalModuleName}{Name}, so two modules can never silently shadow one another’s export (#725) and a full regen never leaves an ambiguous name for tsc to reject.