Summary
An overloaded function loses a public overload and keeps its implementation signature when a local type is declared ahead of it:
interface I { a: number }
export function f(x: string): string
export function f(x: number): number
export function f(x: unknown): unknown { return x }
export const value: I = { a: 1 }emits f(x: string): string and f(x: unknown): unknown, so a consumer's const n: number = f(1) fails and f(true) type-checks. Vue's h comes out as its implementation, h(type: any, propsOrChildren?: any, children?: any): VNode, instead of the typed overloads, and computed loses its writable-options overload for an implementation returning unknown. Stacks' own useInterval, useTimeout and CLI align do the same.
Changes
extractFunction remembered an implementation by the index it expected in declarations (funcBodyIndices.add(declarations.length)). resolveReferencedTypes then inserts the referenced local declarations by source position, which shifts every index after them, so the overload post-process removed the overload sitting at the old index. A non-exported function also added an index although it never goes into declarations. The implementation is now remembered by the declaration object itself.
Matching the right declaration exposed one more case: a named export and a default export of the same name (export function make(...) beside export default function make(...) {}) are two functions, and grouping by name alone would remove one of them. Overload sets are now keyed by name plus default-ness; on main this pair already lost its default export when no local type was involved.
Testing
New test/overload-implementation.test.ts checks the emitted overloads and type-checks a consumer against the output through the existing runTsc helper, with @ts-expect-error on calls only the implementation would accept. On main 4 of its 6 cases fail, for example Expected to contain: "f(x: number): number;" with Received: "export declare function f(x: string): string;\nexport declare function f(x: unknown): unknown;...". The two that pass on main are the named/default pairs with local types, kept as guards. All 6 pass with the fix.
bun test (Zig library built with the pinned Zig, so its tests run too), typecheck, lint, zig build test and the Zig fixture tests pass. Over 4,192 files from vue-core, vue-router, pinia and knip (LF and CRLF) and 11,766 more from tailwindcss, stacks, eslint-plugin-vue and home, nothing new fails to parse, and the six outputs that change are the ones above (h, computed, compatH, align, useInterval, useTimeout), each now with its public overloads and without the implementation signature.