@mui/internal-docs-infra
Version:
MUI Infra - internal documentation creation tools.
21 lines • 1.44 kB
text/typescript
import type { ElementContent } from 'hast';
import type { ScanState } from "./scanState.mjs";
/**
* Tries to create a funcParamContext when "(" is encountered.
* Returns the context if a known owner is detected, otherwise null.
*
* Contexts detected (in priority order):
* 1. Type def arrow: `type Cb = (` — definition site (confirmed by `=>` lookahead)
* 2. Type annotation arrow: `const cb: Type = (` — reference site (confirmed by `=>` lookahead)
* 3. Function declaration: `function name(` — reference site (links via linkMap)
* 4. Deep callback property: inside owner, `{ callback: (` — inherits owner context
* 5. Deep callback via brace-nested prop path: `{ func: {(` or JSX `func={(` — inherits owner context
*/
export declare function tryStartFuncParamContext(state: ScanState, linkMap: Record<string, string>, linkProps: 'shallow' | 'deep' | undefined, linkScope: boolean | undefined, siblings: ElementContent[], siblingIndex: number, charIndex: number): ScanState['funcParamContext'];
/**
* Flushes an unannotated function parameter as a positional scope binding.
* When a param has no type annotation but the funcParamContext has a known owner
* (e.g. from a pendingFuncCall), creates a 'param' binding using positional
* notation like `callFunction[0][0]`.
*/
export declare function flushUnannotatedParam(ctx: NonNullable<ScanState['funcParamContext']>, linkMap: Record<string, string>): void;