fix(ui): derive diff options from the FileDiff component, not FileDiffProps

@pierre/diffs 1.4 added a second required type parameter to FileDiffProps
while keeping defaults on the FileDiff component itself, so FileDiffProps<undefined>
fails with TS2314 under any 1.4.x. The package is declared as ^1.3.0, and the
release pipeline deletes bun.lock and re-resolves, so CI built against 1.4.2
while the committed lockfile pinned 1.3.6 locally.

Deriving the options type from ComponentProps<typeof FileDiff> compiles against
both 1.3.x and 1.4.x, and stops the emitted .d.ts from re-exporting a peer
dependency type whose arity changes between minors.
This commit is contained in:
Saoud Rizwan
2026-09-14 22:37:16 -07:00
parent 128ec277d5
commit b7d4894f04
@@ -11,8 +11,9 @@
*/
import { parseDiffFromFile } from "@pierre/diffs";
import { FileDiff, type FileDiffProps } from "@pierre/diffs/react";
import { FileDiff } from "@pierre/diffs/react";
import {
type ComponentProps,
type CSSProperties,
useEffect,
useMemo,
@@ -20,7 +21,11 @@ import {
useState,
} from "react";
type DiffOptions = NonNullable<FileDiffProps<undefined>["options"]>;
// Derived from the component rather than FileDiffProps: the props interface
// gained a second required type parameter in @pierre/diffs 1.4 while the
// component kept defaults for both, so naming the interface directly pins us
// to one minor of an optional peer dependency declared as ^1.3.0.
type DiffOptions = NonNullable<ComponentProps<typeof FileDiff>["options"]>;
export type ToolFileDiffProps = {
/** File path; used for the header-less language inference. */