fix(typecheck): annotate diff rendering props (#1568)

This commit is contained in:
Bogdan
2026-06-10 08:50:14 +08:00
committed by GitHub
parent 6ee24f78e7
commit e53d612da5
8 changed files with 39 additions and 15 deletions
+9 -3
View File
@@ -20,7 +20,7 @@ type DiffData = {
firstLine: string | null;
fileContent: string | undefined;
};
export function FileEditToolDiff(props) {
export function FileEditToolDiff(props: Props): React.ReactNode {
const $ = _c(7);
let t0;
if ($[0] !== props.edits || $[1] !== props.file_path) {
@@ -50,7 +50,10 @@ export function FileEditToolDiff(props) {
}
return t2;
}
function DiffBody(t0) {
function DiffBody(t0: {
promise: Promise<DiffData>;
file_path: string;
}): React.ReactNode {
const $ = _c(6);
const {
promise,
@@ -78,7 +81,10 @@ function DiffBody(t0) {
}
return t1;
}
function DiffFrame(t0) {
function DiffFrame(t0: {
children?: React.ReactNode;
placeholder?: boolean;
}): React.ReactNode {
const $ = _c(5);
const {
children,
@@ -21,7 +21,7 @@ type Props = {
style?: 'condensed';
verbose: boolean;
};
export function FileEditToolUseRejectedMessage(t0) {
export function FileEditToolUseRejectedMessage(t0: Props): React.ReactNode {
const $ = _c(38);
const {
file_path,
+6 -3
View File
@@ -15,7 +15,7 @@ type Props = {
dim?: boolean;
};
const DEFAULT_WIDTH = 80;
export const HighlightedCode = memo(function HighlightedCode(t0) {
export const HighlightedCode = memo(function HighlightedCode(t0: Props): React.ReactNode {
const $ = _c(21);
const {
code,
@@ -24,7 +24,7 @@ export const HighlightedCode = memo(function HighlightedCode(t0) {
dim: t1
} = t0;
const dim = t1 === undefined ? false : t1;
const ref = useRef(null);
const ref = useRef<DOMElement | null>(null);
const [measuredWidth, setMeasuredWidth] = useState(width || DEFAULT_WIDTH);
const [theme] = useTheme();
const settings = useSettings();
@@ -134,7 +134,10 @@ export const HighlightedCode = memo(function HighlightedCode(t0) {
}
return t7;
});
function CodeLine(t0) {
function CodeLine(t0: {
line: string;
gutterWidth: number;
}): React.ReactNode {
const $ = _c(13);
const {
line,
+6 -3
View File
@@ -36,7 +36,7 @@ function cachedHighlight(hl: NonNullable<Awaited<ReturnType<typeof getCliHighlig
hlCache.set(key, out);
return out;
}
export function HighlightedCodeFallback(t0) {
export function HighlightedCodeFallback(t0: Props): React.ReactNode {
const $ = _c(20);
const {
code,
@@ -121,13 +121,16 @@ export function HighlightedCodeFallback(t0) {
}
return t8;
}
function Highlighted(t0) {
function Highlighted(t0: {
codeWithSpaces: string;
language: string;
}): React.ReactNode {
const $ = _c(10);
const {
codeWithSpaces,
language
} = t0;
let t1;
let t1: ReturnType<typeof getCliHighlightPromise>;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
t1 = getCliHighlightPromise();
$[0] = t1;
+1 -1
View File
@@ -92,7 +92,7 @@ function renderColorDiff(patch: StructuredPatchHunk, firstLine: string | null, f
perHunk.set(key, entry);
return entry;
}
export const StructuredDiff = memo(function StructuredDiff(t0) {
export const StructuredDiff = memo(function StructuredDiff(t0: Props): React.ReactNode {
const $ = _c(26);
const {
patch,
+1 -1
View File
@@ -141,7 +141,7 @@ export function DiffDialog(t0) {
t8 = $[15];
}
useEffect(t7, t8);
useRegisterOverlay("diff-dialog");
useRegisterOverlay("diff-dialog", true);
let t10;
let t9;
if ($[16] !== sources.length || $[17] !== viewMode) {
@@ -13,7 +13,7 @@ type Props = {
fileExists: boolean;
oldContent: string;
};
export function FileWriteToolDiff(t0) {
export function FileWriteToolDiff(t0: Props): React.ReactNode {
const $ = _c(15);
const {
file_path,
+14 -2
View File
@@ -157,7 +157,14 @@ type RejectionDiffData = {
firstLine: string | null;
fileContent: string | undefined;
};
function EditRejectionDiff(t0) {
function EditRejectionDiff(t0: {
filePath: string;
oldString: string;
newString: string;
replaceAll: boolean;
style?: 'condensed';
verbose: boolean;
}): React.ReactNode {
const $ = _c(16);
const {
filePath,
@@ -210,7 +217,12 @@ function EditRejectionDiff(t0) {
}
return t4;
}
function EditRejectionBody(t0) {
function EditRejectionBody(t0: {
promise: Promise<RejectionDiffData>;
filePath: string;
style?: 'condensed';
verbose: boolean;
}): React.ReactNode {
const $ = _c(7);
const {
promise,