UNPKG

@mui/internal-docs-infra

Version:

MUI Infra - internal documentation creation tools.

41 lines 1.91 kB
import type * as tae from 'typescript-api-extractor'; /** * A map from original type names to their canonical export names. * For example: "DialogTrigger" -> "AlertDialog.Trigger" */ export type TypeCompatibilityMap = Map<string, string>; /** * Builds a map from original type names to their canonical export names. * * This map is built from two sources: * 1. `reexportedFrom` - when an export is re-exported with a different name * e.g., `export { DialogTrigger as Trigger }` -> "DialogTrigger" -> "AlertDialog.Trigger" * 2. `extendsTypes` - when an interface extends another type * e.g., `interface AlertDialogRootProps extends Dialog.Props` -> "Dialog.Props" -> "AlertDialog.Root.Props" * * The map allows type references in the original namespace to be rewritten * to the canonical namespace in the documentation. */ export declare function buildTypeCompatibilityMap(allExports: tae.ExportNode[], exportNames: string[]): TypeCompatibilityMap; /** * Context for type string rewriting operations. */ export interface TypeRewriteContext { /** Map from original type names to their canonical export names */ typeCompatibilityMap: TypeCompatibilityMap; /** Available export names in the current module for namespace resolution */ exportNames: string[]; /** Map from flat type names to dotted names (e.g., AlertDialogTriggerState -> AlertDialog.Trigger.State) */ typeNameMap?: Record<string, string>; } /** * Recursively rewrites type strings in a data structure. * * This function traverses objects, arrays, and primitive values, applying type name * transformations to all string values. Used to normalize type references after * formatting. * * The function preserves the structure of the input, only transforming string values, * so the output type matches the input type. */ export declare function rewriteTypeStringsDeep<T>(node: T, context: TypeRewriteContext): T;